Re: [PERFORM] Performance of count(*) on large tables vs SQL Server

2005-02-01 Thread PFC
clause will be a cheap query - and use it to test if a table is empty, for instance. (because for Oracle/Sybase/SQL Server, count(*) is cheap). To test if a table is empty, use a SELECT EXISTS or whatever SELECT with a LIMIT 1... ---(end of broadcast)--

Re: [PERFORM] Performance of count(*) on large tables vs SQL Server

2005-02-01 Thread Stef
Hello Andrew, Everything that Shridhar says makes perfect sense, and, speaking from experience in dealing with this type of 'problem', everything you say does as well. Such is life really :) I would not be at -all- surprised if Sybase and Oracle did query re-writing behind the sc

Re: [PERFORM] Performance of count(*) on large tables vs SQL Server

2005-02-01 Thread Shridhar Daithankar
On Tuesday 01 Feb 2005 6:11 pm, Andrew Mayo wrote: > PG, on the other hand, appears to do a full table scan > to answer this question, taking nearly 4 seconds to > process the query. > > Doing an ANALYZE on the table and also VACUUM did not > seem to affect this. > > Can PG find a table's row count

[PERFORM] Performance of count(*) on large tables vs SQL Server

2005-02-01 Thread Andrew Mayo
Doing some rather crude comparative performance tests between PG 8.0.1 on Windows XP and SQL Server 2000, PG whips SQL Server's ass on insert into junk (select * from junk) on a one column table defined as int. If we start with a 1 row table and repeatedly execute this command, PG can take the ta