Re: Wrong plan or what ?

Поиск
Список
Период
Сортировка
От HansH
Тема Re: Wrong plan or what ?
Дата
Msg-id bftml3$vmq$1@news.cistron.nl
обсуждение исходный текст
Ответ на Wrong plan or what ?  ("Mendola Gaetano" <mendola@bigfoot.com>)
Список pgsql-admin
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





В списке pgsql-admin по дате отправления:

Предыдущее
От: Daniel Gerardo Lucero Baylon
Дата:
Сообщение: Starting PostgreSQL server as root
Следующее
От: "John P. Looney"
Дата:
Сообщение: