Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9A513477335 for ; Wed, 22 Jan 2003 17:39:17 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D79A1476F02 for ; Wed, 22 Jan 2003 17:04:03 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h0MM3u5u024610; Wed, 22 Jan 2003 17:03:56 -0500 (EST) To: "Patrick Hatcher" Cc: pgsql-performance@postgresql.org Subject: Re: Slow query on OS X box In-reply-to: References: Comments: In-reply-to "Patrick Hatcher" message dated "Wed, 22 Jan 2003 10:26:17 -0800" Date: Wed, 22 Jan 2003 17:03:55 -0500 Message-ID: <24609.1043273035@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/232 X-Sequence-Number: 879 "Patrick Hatcher" 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