From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | VanL <vlindberg(at)verio(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Seemingly identical queries run at different speeds |
Date: | 2003-07-24 23:36:43 |
Message-ID: | 20030724233643.GE13026@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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)
From | Date | Subject | |
---|---|---|---|
Next Message | Arguile | 2003-07-24 23:46:13 | Re: Can I turn the case sensitive off |
Previous Message | Terence Chang | 2003-07-24 23:34:26 | Can I turn the case sensitive off |