Re: left join on a view takes significantly more time.

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-sql(at)postgresql(dot)org
Subject: Re: left join on a view takes significantly more time.
Date: 2004-03-31 23:49:29
Message-ID: 200403311549.29211.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Manuel,

> I'm facing a wired problem. When I left join two tables PostgreSQL is
> able to do it fast using the corresponding indices, However, if I
> define a simple view (to format the data) on one of the tables, the
> left join does not use the indices. Is something wrong here?

At a guess, the complex CASE statements are causing the planner to behave
badly. What happens if you do a straight join and not a left join?

Also, it's generally a good idea to put your join expression in the same order
as the referenced tables. You confused me and you could confuse the planner
at some stage.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Olivier Hubaut 2004-04-01 07:07:52 Re: Is it normal that functions are so much faster than inline queries
Previous Message Josh Berkus 2004-03-31 22:41:22 Re: [SQL] SQL Spec Compliance Questions