pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: HansH <hartenhans@op.het.net>
To: pgsql-admin@postgresql.org
Subject: Re: Wrong plan or what ?
Date: Sat, 26 Jul 2003 12:53:23 +0200
Message-ID: <bftml3$vmq$1@news.cistron.nl> (raw)
References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2>

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








view thread (8+ messages)  latest in thread

Message-ID: <bftml3$vmq$1@news.cistron.nl>
Permalink:  ../bftml3$vmq$1@news.cistron.nl/
Also on:    postgresql.org/message-id/bftml3$vmq$1@news.cistron.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: hartenhans@op.het.net, pgsql-admin@postgresql.org
  Subject: Re: Wrong plan or what ?
  In-Reply-To: <bftml3$vmq$1@news.cistron.nl>
  References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> <bftml3$vmq$1@news.cistron.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox