Jim Wilcoxson wrote: > If you have a table where rows are inserted but never deleted, and you > have a rowid column, you can use this: > > select seq from sqlite_sequence where name = 'tablename'
This works only for an AUTOINCREMENT column. > This will return instantly, without scanning any rows or indexes, and > is much faster than max(rowid) for huge tables. Max(rowid) has a special optimization and looks only at the last entry in the index. It is what SQLite uses internally for tables without AUTOINCREMENT, and is actually faster than looking up the sequence value in a separate table. Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users