Re: OR problems

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: tony <tony(at)animaproductions(dot)com>
Cc: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Re: OR problems
Date: 2002-03-22 18:54:47
Message-ID: 3C9B7DF7.7A9396E1@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tony,

The problem is not with the OR or the DISTINCT ON.
You are requesting a cartesian product ot three tables.
You should have a JOIN ON or a proper WHERE clause.

JLL

tony wrote:
>
> Hello,
>
> I've been having some problems with this SELECT clause.
>
> SELECT DISTINCT ON (nom, prenom) nom, prenom, sexe, titre, type,
> structure.adresse, structure.boitepostal, structure.codepostal,
> structure.ville
> FROM individu, structure, fonction
> WHERE type = 'CT' OR type = 'CA'
>
> The DISTINCT ON bit puts the query into a flat tailspin. Why?
>
> Cheers
>
> Tony Grant
>
> --
> RedHat Linux on Sony Vaio C1XD/S
> http://www.animaproductions.com/linux2.html
> Macromedia UltraDev with PostgreSQL
> http://www.animaproductions.com/ultra.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-03-22 18:55:04 Re: Huge Performance Difference on Similar Query in Pg7.2
Previous Message David Siebert 2002-03-22 18:49:46 Re: Yet another indexing issue.