X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0ADF852849 for ; Tue, 21 Jun 2005 12:14:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28620-09 for ; Tue, 21 Jun 2005 15:14:30 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 509B3528BB for ; Tue, 21 Jun 2005 12:14:29 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621151429m9100nh2uoe>; Tue, 21 Jun 2005 15:14:29 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 218EB55FB6; Tue, 21 Jun 2005 10:14:26 -0500 (CDT) Message-ID: <42B82ED0.1010009@arbash-meinel.com> Date: Tue, 21 Jun 2005 10:14:24 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Limit clause not using index References: <42B8275C.8040300@arbash-meinel.com> <7e514564b9a159480857de53cc1764fd@implements.be> In-Reply-To: <7e514564b9a159480857de53cc1764fd@implements.be> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFC724075688C16CC1C852EB9" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/389 X-Sequence-Number: 13026 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFC724075688C16CC1C852EB9 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Yves Vindevogel wrote: > rvponp=# explain analyze select * from tblPrintjobs order by > loginuser, desceventdate, desceventtime ; > QUERY PLAN > -------------------------------------------------------------------------------------------------------------------------------- > > Sort (cost=345699.06..347256.49 rows=622972 width=203) (actual > time=259438.952..268885.586 rows=622972 loops=1) > Sort Key: loginuser, desceventdate, desceventtime > -> Seq Scan on tblprintjobs (cost=0.00..25596.72 rows=622972 > width=203) (actual time=21.155..8713.810 rows=622972 loops=1) > Total runtime: 271583.422 ms > (4 rows) Can you post it with the limit? I realize the query takes a long time, but that is the more important query to look at. Also, just as a test, if you can, try dropping most of the indexes except for the important one. It might be that the planner is having a hard time because there are too many permutations to try. I believe if you drop the indexes inside a transaction, they will still be there for other queries, and if you rollback instead of commit, you won't lose anything. BEGIN; DROP INDEX ... EXPLAIN ANALYZE SELECT *... ROLLBACK; John =:-> --------------enigFC724075688C16CC1C852EB9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuC7QJdeBCYSNAAMRAqhPAJ96D2JK9uRlEzObVbGd3n3Tttoh6gCdFICG jsuBrmMCNswfIgrBo9rcfR8= =tiqi -----END PGP SIGNATURE----- --------------enigFC724075688C16CC1C852EB9--