On Saturday, January 29, 2011 at 3:06 PM, Marian Cascaval wrote:

> As I see it,from the point of view of just retrieving the last row from a 
> table, 
> no ORDER BY is necessary thus saving processor time. 


No, no, no, no. The db doesn't know what you mean by "last". If it happens to 
give you back what you wanted, good. But, don't get into the habit of depending 
on that. Get into a good habit -- tell the database exactly what you want. 
Specify the ORDER BY clause, and be assured of what you want.


And, with regards to saving processor time, don't even waste any brain cycles 
on that. Unless you have a database table with upward of several hundreds of 
thousands of rows, your processor is not going to sweat or complain. Make sure 
you index your table on the columns you want to use for retrieval, and let the 
db do its job. Make sure to always tell the db what you want. Don't be lulled 
into thinking you are always gonna get the right results just because you 
happen to get the right results in a few cases.


 -- 
Puneet Kishor
Sent with Sparrow 


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

Reply via email to