Re: Slow query on OS X box

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow query on OS X box
Date: 2003-01-22 22:03:55
Message-ID: 24609.1043273035@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Patrick Hatcher" <PHatcher(at)macys(dot)com> writes:
> I have a table that contains over 13 million rows. This query takes an
> extremely long time to return. I've vacuum full, analyzed, and re-indexed
> the table. Still the results are the same. Any ideas?

> mdc_oz=# explain analyze select wizard from search_log where wizard
> ='Keyword' and sdate between '2002-12-01' and '2003-01-15';
> QUERY PLAN
> -----------------------------------------------------------------------------------------------------------------------------
> Seq Scan on search_log (cost=0.00..609015.34 rows=3305729 width=10)
> (actual time=99833.83..162951.25 rows=3280573 loops=1)
> Filter: ((wizard = 'Keyword'::character varying) AND (sdate >
> = '2002-12-01'::date) AND (sdate <= '2003-01-15'::date))
> Total runtime: 174713.25 msec
> (3 rows)

This query is selecting 3280573 rows out of your 13 million. I'd say
the machine is doing the best it can. Returning 19000 rows per second
is not all that shabby.

Perhaps you should rethink what you're doing. Do you actually need to
return 3 million rows to the client?

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Rod Taylor 2003-01-22 22:54:20 Re: Slow query on OS X box
Previous Message John Lange 2003-01-22 21:44:42 Query plan and Inheritance. Weird behavior