X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ECACEDB62B for ; Tue, 1 Nov 2005 19:28:03 -0400 (AST) 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 34024-01 for ; Tue, 1 Nov 2005 23:28:00 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 8881EDB53D for ; Tue, 1 Nov 2005 19:28:01 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EX5Xu-00036E-27; Wed, 02 Nov 2005 00:28:03 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EX5Y8-00041j-00; Wed, 02 Nov 2005 00:28:16 +0100 Date: Wed, 2 Nov 2005 00:28:16 +0100 From: "Steinar H. Gunderson" To: Mitch Pirtle Cc: "pgsql-performance@postgresql.org" Subject: Re: Joining views disables indexes? Message-ID: <20051101232816.GA15321@uio.no> Mail-Followup-To: Mitch Pirtle , "pgsql-performance@postgresql.org" References: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> X-Operating-System: Linux 2.6.14-rc5 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/19 X-Sequence-Number: 15276 On Tue, Nov 01, 2005 at 06:16:59PM -0500, Mitch Pirtle wrote: > I have a client that is testing an internal data platform, and they > were happy with PostgreSQL until they tried to join views - at that > time they discovered PostgreSQL was not using the indexes, and the > queries took 24 hours to execute as a result. > > Is this a known issue, or is this possibly a site-specific problem? This is way too general to give a good solution. In general, PostgreSQL should have no problem using indexes on joins (in versions before 8.0, there was a problem using indexes on joins of differing data types, though). This does of course assume that its statistics are good; I assume you've doing ANALYZE on the database after loading the database? What you want to do is to post your table definitions and EXPLAIN ANALYZE output of a slow query; that could be difficult if it takes 24 hours, though, so you might try a slightly quicker query for starters. /* Steinar */ -- Homepage: http://www.sesse.net/