Re: Query plan not using index for some reason.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query plan not using index for some reason.
Date: 2002-10-01 17:13:45
Message-ID: 5864.1033492425@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp> writes:
> $ psql TMP -c "explain select products.id as pid from
> products,rel_genres_movies where maker_id='53' OR
> (rel_genres_movies.minor_id='11' AND rel_genres_movies.prod_id=products.id)"

Is that *really* the query you want to run?

Rows having maker_id=53 will be joined to *every* row of the other
table. I'm suspecting you really wanted
where (maker_id='53' OR rel_genres_movies.minor_id='11') AND
rel_genres_movies.prod_id=products.id
so that the join behaves sensibly.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2002-10-01 17:40:13 Re: Query plan not using index for some reason.
Previous Message Joe Conway 2002-10-01 16:53:03 Re: string parsing