There is no guarantee that it always gets the correct  result.
For example, we  insert 10 records and then delete 2 of  them. 
If the 2 records does not hold the maximum id, the result is not correct.




________________________________
From: jesuscheung <jesusche...@hotmail.com>
To: sqlite-users@sqlite.org
Sent: Friday, January 9, 2009 3:41:54 AM
Subject: Re: [sqlite] How to get the total row number of a table by Sqlite more 
efficient?


if your table's primary key is auto incremented, try:

select max(id) from table

this will be faster than using count()
-- 
View this message in context: 
http://www.nabble.com/How-to-get-the-total-row-number-of-a-table-by-Sqlite-more-efficient%EF%BC%9F-tp20061797p21359430.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to