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 will return instantly, without scanning any rows or indexes, and is much faster than max(rowid) for huge tables. If no rows have been inserted, you will get NULL. If rows have been inserted, you will get back the last rowid inserted. Jim Simon wrote: If this is a table for which rows are inserted but never deleted, then you will find that SELECT max(rowid) FROM hp_table1 returns the same value almost immediately. Perhaps value-1, but whatever it is it'll be consistent. -- HashBackup: easy onsite and offsite Unix backup http://www.hashbackup.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users