joins and indexes -- a=b or b=a? - Mailing list pgsql-general

From will trillich
Subject joins and indexes -- a=b or b=a?
Date
Msg-id 20010328170111.B16380@mail.serensoft.com
Whole thread Raw
Responses Re: joins and indexes -- a=b or b=a?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Marek Pętlicki
Date:
Subject: Re: how to load a sql-file????
Next
From: will trillich
Date:
Subject: Re: how to load a sql-file????