Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 84D899FB3FA; Mon, 6 Aug 2007 10:07:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 89446-04; Mon, 6 Aug 2007 10:07:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from oxford.xeocode.com (unknown [62.232.55.118]) by postgresql.org (Postfix) with ESMTP id 6EBE39FB2BD; Mon, 6 Aug 2007 10:07:22 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1II2Io-0003d8-5i; Mon, 06 Aug 2007 14:07:18 +0100 From: Gregory Stark To: "Henrik Zagerholm" Cc: , Subject: Re: [PERFORM] Planner making wrong decisions 8.2.4. Insane cost calculations. In-Reply-To: <0C963119-103A-4EB1-B9D8-0FD3E16A11F0@mac.se> (Henrik Zagerholm's message of "Mon, 6 Aug 2007 14:21:10 +0200") Organization: EnterpriseDB References: <0C963119-103A-4EB1-B9D8-0FD3E16A11F0@mac.se> X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 1870) Date: Mon, 06 Aug 2007 14:07:17 +0100 Message-ID: <87abt4n75m.fsf@oxford.xeocode.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/281 X-Sequence-Number: 118130 "Henrik Zagerholm" writes: > Hi list, > > I'm having a weird acting query which simply retrieves some files stored in a db > which are related to a specific archive and also has a size lower than 1024 > bytes. > Explain analyze below. The first one is with seq-scan enabled and the other one > with seq-scans disabled. The weird thing is the seq scan on tbl_file_structure > and also the insane calculated cost of 100 000 000 on some tables. Well the way Postgres disables a plan node type is by giving it a cost of 100,000,000. What other way did you expect it to be able to scan tbl_filetype_suffix anyways? What indexes do you have on tbl_filetype_suffix? And any chance you could resend this stuff without the word-wrapping? It's pretty hard to read like this: " -> Seq Scan on tbl_filetype_suffix (cost=100000000.00..100000001.34 rows=14 width=8) (actual time=0.133..0.176 rows=14 loops=1)" " Filter: (filetype_suffix_index IS TRUE)" -- Gregory Stark EnterpriseDB http://www.enterprisedb.com