Re: Wrong plan or what ?

From: "HansH" <hartenhans(at)op(dot)het(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Wrong plan or what ?
Date: 2003-07-26 10:53:23
Message-ID: bftml3$vmq$1@news.cistron.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

In response to "Mendola Gaetano":
> I'm running Postgres7.3.3 and I'm performing this simple select:

Looking at your fast three step plan
> SELECT id_class from class_default where id_provider = 39;
> SELECT id_user from user_data where id_class in ( 48 );
> SELECT * from user_logs where id_user in (
> 10943, 10942, 10934, 10927, 10910, 10909 );
I'ld stem for reordering the from and where clauses alike:
select *
from
class_default cd,
user_data ud,
user_logs ul
where
cd.id_provider = 39 and
ud.id_class = cd.id_class and
ul.id_user = ud.id_user;

Personally I dislike implied joins and rather go for _about_ this:
select *
from
( class_default cd
LEFT JOIN user_data ud ON ud.id_class = cd.id_class )
LEFT JOIN user_logs ul ON ul.id_user = ud.id_user,
where
cd.id_provider = 39;

Good luck,

HansH

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2003-07-26 14:42:29 Re: parallel regression test failure
Previous Message Ludwig Isaac Lim 2003-07-26 08:17:23 Stuck Spinlock Error Message

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-07-26 14:12:35 Re: Tuning PostgreSQL
Previous Message Arjen van der Meijden 2003-07-26 10:18:37 Re: Tuning PostgreSQL