> -----Original Message----- > From: Ali Sadik Kumlali [mailto:[EMAIL PROTECTED] > Sent: Monday, March 29, 2004 3:09 PM > To: [EMAIL PROTECTED] > Subject: RE: [sqlite] Is using max(rowid) instead of count(*) safe? > > > Thanks for taking your time. I'm using P3 600Mhz, 512MB, Win2K Pro for > the test. Here is what I've done: > > CREATE TABLE TEST( > ID NUMBER(12) PRIMARY KEY, > NAME VARCHAR(19) > ) > > -- Transfers 3.5 million rows > COPY OR IGNORE TEST FROM 'C:\\DATA.CSV' USING DELIMITERS ';' > > -- takes about 9 seconds > SELECT COUNT(ID) FROM TEST
Try again with COUNT(*) instead of COUNT(ID) if you just want the number of rows. The latter needs to figure out which rows have ID NOT NULL, but the latter just counts all rows. I'm surprised that COUNT(ID) would take 9 seconds, but you could also try creating the table with ID's type as "INTEGER PRIMARY KEY NOT NULL" so that you're using the BTree table index directly. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]