joins and indexes -- a=b or b=a?

Поиск
Список
Период
Сортировка
От will trillich
Тема joins and indexes -- a=b or b=a?
Дата
Msg-id 20010328170111.B16380@mail.serensoft.com
обсуждение исходный текст
Ответы Re: joins and indexes -- a=b or b=a?
Список pgsql-general
if you have a main table on which you're doing a linear scan:

    create table person (
        id varchar(12), -- handle/id/login
        name varchar(30),
        gang int4
    );

that joins another indexed table:

    create table gang (
        id serial,
        name varchar(30),
    primary key(id)
    );

is there any significant difference in the following two queries:

    select
        p.id as handle, p.name as person, g.name as gang
    from
        person p, gang g
    where
        PERSON.GANG = GANG.ID
    ;

    -- as opposed to:

    select
        p.id as handle, p.name as person, g.name as gang
    from
        person p, gang g
    where
        GANG.ID = PERSON.GANG
    ;

the only difference is GANG.ID=PERSON.GANG versus
PERSON.GANG=GANG.ID in the WHERE clause. does it matter?

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
        -- Isaac Asimov, 'The Genetic Code'

will@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

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

Предыдущее
От: Marek Pętlicki
Дата:
Сообщение: Re: how to load a sql-file????
Следующее
От: will trillich
Дата:
Сообщение: Re: how to load a sql-file????