Re: Question about difference in performance of 2 queries - Mailing list pgsql-performance

From Sean Shanny
Subject Re: Question about difference in performance of 2 queries
Date
Msg-id 3FF07FB2.5060608@earthlink.net
Whole thread Raw
In response to Re: Question about difference in performance of 2 queries on large table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Here is one of the explain analyzes.  This is the from the faster
query.  Ignore the total runtime as we are currently doing other queries
on this machine so it is slightly loaded.

Thanks.

--sean


explain analyze select count (distinct (persistent_cookie_key) ) from
f_pageviews where date_key between 305 and 334 and content_key <> -1;

QUERY PLAN


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=1384925.95..1384925.95 rows=1 width=4) (actual
time=4541462.030..4541462.034 rows=1 loops=1)
   ->  Index Scan using idx_pageviews_date_nov_2003 on f_pageviews
(cost=0.00..1343566.52 rows=16543772 width=4) (actual
time=83.267..4286664.678 rows=15710722 loops=1)
         Index Cond: ((date_key >= 305) AND (date_key <= 334))
         Filter: (content_key <> -1)
 Total runtime: 4541550.832 ms
(5 rows)

Tom Lane wrote:

>Please show EXPLAIN ANALYZE output for your queries, not just EXPLAIN.
>Also it would be useful to see the pg_stats rows for the date_key and
>content_key columns.
>
>            regards, tom lane
>
>
>


pgsql-performance by date:

Previous
From: Sean Shanny
Date:
Subject: Re: Question about difference in performance of 2 queries
Next
From: Tom Lane
Date:
Subject: Re: Question about difference in performance of 2 queries