Re: [PERFORM] count is ten times faster

2010-04-14 Thread Kevin Grittner
"Sabin Coanda" wrote: > How do you explain the cost is about ten times lower in the 2nd > query than the first ? To elaborate on Pierre's answer: In the first query, you scan the entire table and execute the "f1" function on each row. In the second query you pass the entire table just count

Re: [PERFORM] count is ten times faster

2010-04-13 Thread Pierre C
How do you explain the cost is about ten times lower in the 2nd query than the first ? Function call cost ? Can you EXPLAIN ANALYZE ? -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-

[PERFORM] count is ten times faster

2010-04-13 Thread Sabin Coanda
Hi there, I have a simple aggregate query: SELECT count("PK_ID") AS "b1" FROM "tbA" WHERE "PK_ID" > "f1"( 'c1' ), which has the following execution plan: "Aggregate (cost=2156915.42..2156915.43 rows=1 width=4)" " -> Seq Scan on "tbA" (cost=0.00..2137634.36 rows=7712423 width=4)" "Filt