optimize isExistTable function (#3236)
* Update EmbeddedStoragePersistServiceImpl.java If the table data volume is large, count (*) will be particularly slow * Update ExternalStoragePersistServiceImpl.java If the table data volume is large, count (*) will be particularly slow * Update ExternalStoragePersistServiceImpl.java * Update EmbeddedStoragePersistServiceImpl.java
This commit is contained in:
parent
8c9622fbda
commit
2f5fb235b2
@ -2113,7 +2113,7 @@ public class EmbeddedStoragePersistServiceImpl implements PersistService {
|
||||
}
|
||||
|
||||
public boolean isExistTable(String tableName) {
|
||||
String sql = "SELECT COUNT(*) FROM " + tableName;
|
||||
String sql = String.format("select 1 from %s limit 1", tableName);
|
||||
try {
|
||||
databaseOperate.queryOne(sql, Integer.class);
|
||||
return true;
|
||||
|
@ -3147,7 +3147,7 @@ public class ExternalStoragePersistServiceImpl implements PersistService {
|
||||
}
|
||||
|
||||
public boolean isExistTable(String tableName) {
|
||||
String sql = "SELECT COUNT(*) FROM " + tableName;
|
||||
String sql = String.format("select 1 from %s limit 1", tableName);
|
||||
try {
|
||||
jt.queryForObject(sql, Integer.class);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user