Re: Seemingly identical queries run at different speeds - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Seemingly identical queries run at different speeds
Date
Msg-id 20030724233643.GE13026@dcc.uchile.cl
Whole thread Raw
In response to Seemingly identical queries run at different speeds  (VanL <vlindberg@verio.net>)
List pgsql-general
On Tue, Jul 22, 2003 at 05:27:37PM -0600, VanL wrote:

> I have three queries that are essentially identical.  Two of them run in
> fractions of a second; one of them takes longer than 15 minutes to
> return. (Not sure how long it totally takes, that has been the limit of
> my patience.)
>
> The only difference between these queries is the use of table aliases in
> the sql query.  What is happening in postgres that this makes such a
> difference?

I think the third query is adding items to the FROM clause that you
probably don't want.  The result is a cartesian product, which is going
to take eons to materialize (i.e. give results back).

See:
http://www14.us.postgresql.org/docs/7.3/static/sql-select.html#R2-SQL-SELECT-4

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)

pgsql-general by date:

Previous
From: "Terence Chang"
Date:
Subject: Can I turn the case sensitive off
Next
From: Arguile
Date:
Subject: Re: Can I turn the case sensitive off