diff options
author | bamse16 <marius@marius.me.uk> | 2010-01-14 06:37:43 +0000 |
---|---|---|
committer | bamse16 <marius@marius.me.uk> | 2010-01-14 06:37:43 +0000 |
commit | 0b48b40370b5a49144f39ae95888f3fbcd1aa048 (patch) | |
tree | d8dbeff96d5c788b3342244eb122de235f7339be /Source/SPTableData.m | |
parent | 08fb692301568e7143271ffad9bbcb3a5b247de5 (diff) | |
download | sequelpro-0b48b40370b5a49144f39ae95888f3fbcd1aa048.tar.gz sequelpro-0b48b40370b5a49144f39ae95888f3fbcd1aa048.tar.bz2 sequelpro-0b48b40370b5a49144f39ae95888f3fbcd1aa048.zip |
Replace COUNT(*) with COUNT(1) which is usually faster, and much faster in certain conditions
Diffstat (limited to 'Source/SPTableData.m')
-rw-r--r-- | Source/SPTableData.m | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 0411458a..0c8d2517 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -779,10 +779,10 @@ [status setObject:@"n" forKey:@"RowsCountAccurate"]; } - // [status objectForKey:@"Rows"] is NULL then try to get the number of rows via SELECT COUNT(*) FROM `foo` + // [status objectForKey:@"Rows"] is NULL then try to get the number of rows via SELECT COUNT(1) FROM `foo` // this happens e.g. for db "information_schema" if([[status objectForKey:@"Rows"] isKindOfClass:[NSNull class]]) { - tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@", [escapedTableName backtickQuotedString] ]]; + tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [escapedTableName backtickQuotedString] ]]; if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) [status setObject:[[tableStatusResult fetchRowAsArray] objectAtIndex:0] forKey:@"Rows"]; [status setObject:@"y" forKey:@"RowsCountAccurate"]; |