Re: Joining views disables indexes?

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(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:23:14
Message-ID: 20051101232314.GV20349@pervasive.com
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?
>
> They just implemented the exact same datamodel in MySQL 5.0, with
> views and InnoDB tables, and performance is still subsecond.
>
> Would love to know if this is a known issue.

Views simply get expanded to a full query, so the views have nothing to
do with it.

Make sure that they've run analyze on the entire database. Upping
default_statistics_target to 100 is probably a good idea as well.

If that doesn't work, get an explain analyze of the query and post it
here. You can try posting just an explain, but that's much less useful.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Steinar H. Gunderson 2005-11-01 23:28:16 Re: Joining views disables indexes?
Previous Message Mitch Pirtle 2005-11-01 23:16:59 Joining views disables indexes?