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.



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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to