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 -- takes <0.1 seconds SELECT MAX(ID) FROM TEST -- takes <0.1 seconds SELECT MAX(ROWID) FROM TEST --- Balthasar Indermuehle <[EMAIL PROTECTED]> wrote: > Not sure where your performance problems are!? > > I created a test database on my laptop (winxp) with my tester app. > Inserted 1 million records with random data. Here's how fast this > works, > MAX takes .168ms (milliseconds, not seconds!), count() with a where > clause takes 266ms. > > SELECT MIN(rand) AS out FROM t_test returns 1.02212652564049E-6 Time: > .318 ms > ---------- > SELECT MAX(rand) AS out FROM t_test returns 0.999998970422894 Time: > .168 > ms > ---------- > SELECT SUM(rand) AS out FROM t_test returns 500095.604959011 Time: > 944.533 ms > ---------- > SELECT AVG(rand) AS out FROM t_test returns 0.500095604959011 time: > 950.86 ms > ---------- > SELECT COUNT(*) AS out FROM t_test WHERE rand > 0.5 retrieved 500,516 > records. t > ime: 266.787 ms > > And this is is with itunes and more running at the same time on the > machine... Maybe you didn't index the table? Indexing makes all the > difference in the world. > > Cheers > > Balthasar Indermuehle > Inside Systems GmbH > http://www.inside.net > > "Louis Pasteur's theory of germs is ridiculous fiction." > Pierre Pachet, Professor of Physiology at Toulouse, 1872 . > > > > -----Original Message----- > From: Cesare D'Amico [mailto:[EMAIL PROTECTED] > Sent: Monday, March 29, 2004 12:09 > To: [EMAIL PROTECTED] > Subject: Re: [sqlite] Is using max(rowid) instead of count(*) safe? > > > Alle 08:54, luned́ 29 marzo 2004, Ali Sadik Kumlali ha scritto: > > I wonder if I could use max(rowid) safely instead of count(*). Does > > rowid increments by 1 for each new row? > > As previously stated, it's not safe. > > A workaround could be to create an additional table with one field > and > one row, in which you put the number of rows of the other table. At > every insert or delete on the big table, you should update the value > of > this counter (the best way I can think of is using a trigger, with a > single atomic update: UPDATE table_counter SET counter = counter + > 1). > > Ciao > ce > -- > Cesare D'Amico - boss (@t) cesaredamico (dot) com > http://www.cesaredamico.com ~ http://www.phpday.it > There should be one-- and preferably only one --obvious way to do it. > Although that way may not be obvious at first unless you're Dutch. > -- The Zen of Python, by Tim Peters > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]