Re: Planner forces seq scan when select without quoting its values

From: Alex Lai <mlai(at)sesda2(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Planner forces seq scan when select without quoting its values
Date: 2012-09-17 15:22:30
Message-ID: 50574036.2060808@sesda2.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> This line from the EXPLAIN output suggests that the rule is causing a
> seq scan
> to be used instead on an index scan:
>
> ... WHERE ... a.archiveset = new.archiveset AND a.fileid <>
> new.fileid.
>
> When I replace the "new." with actual integers:
>
> ... WHERE ... a.archiveset = 10003 AND a.fileid <> 35352974,
>
> the problem goes away.
>
> That makes me think that the planner is unable to find the index, so
> it instead
> uses a seq scan.
>
I still don't have find any good suggestion.
If the cause by the key word "new" or "old" in the rule, the planner is
confused which index to use.
I think this is should be considered as a bug for rule system related to
planner. I am not sure 9.2 will address this issue.

--
Best regards,

Alex Lai
OMI SIPS DBA ADNET Systems , Inc.
7515 Mission Drive,
Suite A100 Lanham, MD 20706
301-352-4657 (phone)
301-352-0437 (fax)
alai(at)sesda2(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2012-09-17 15:29:58 Re: Slow counting still true?
Previous Message Edson Richter 2012-09-17 15:11:18 Re: Get time for each operation in "Explain..."