Re: Joining views disables indexes?

From: "Steinar H(dot) Gunderson" <sgunderson(at)bigfoot(dot)com>
To: Mitch Pirtle <mitch(dot)pirtle(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Joining views disables indexes?
Date: 2005-11-01 23:28:16
Message-ID: 20051101232816.GA15321@uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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/

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-11-01 23:28:44 Re: Joining views disables indexes?
Previous Message Jim C. Nasby 2005-11-01 23:23:14 Re: Joining views disables indexes?