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:
Joe 2020-07-04 09:27:18 +08:00 committed by GitHub
parent 8c9622fbda
commit 2f5fb235b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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;