From: Kyle Bateman <kyle@actarg.com>
To: mig@utdt.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: Index not used in functions in 7.0?
Date: Tue, 16 May 2000 12:13:10 -0600
Message-ID: <39218FB6.450431A8@actarg.com> (raw)
References: <3921689A.B70CFAC8@actarg.com>
<21401.958492203@sss.pgh.pa.us>
<21654.958494988@sss.pgh.pa.us>
<200005161800.PAA21319@ant.utdt>
mig@utdt.edu wrote:
> I am probably completely wrong, but at least it will be short ...
>
> Could it be that
> select sum(tquant)
> from mtr_reg
> where to_proj = $2
> and pnum = $1
> and (status = 'clsd' or status = 'open' or status = 'prip')
> ;
> makes it harder for the optimizer due to the ORs, and that
> select sum(tquant)
> from mtr_reg
> where to_proj = $2
> and pnum = $1
> and status in ('clsd','open','prip')
> --- last line changed
> ;
> would produce a better cost estimate?
>
> Miguel Sofer
Thanks for the input. Your point might be correct, but my results are
the same regardless of the clause attached to the status field. In one
of my tests, the query simply had "and status = 'clsd'." The issue here
is that a sequential scan is being chosen over an indexed scan when the
query is run from within a function.
Attachments:kyle.vcf (text/x-vcard, 290B) download
begin:vcard
n:Bateman;Kyle
tel;fax:801-377-8096
tel;work:801-377-8033x101
x-mozilla-html:FALSE
url:www.actiontarget.com
org:Action Target Inc
adr:;;PO Box 636;Provo;UT;84603;US
version:2.1
email;internet:kyle@actiontarget.com
title:President
x-mozilla-cpt:;-15520
fn:Kyle Bateman
end:vcard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: kyle@actarg.com, mig@utdt.edu
Subject: Re: Index not used in functions in 7.0?
In-Reply-To: <39218FB6.450431A8@actarg.com>
References: <3921689A.B70CFAC8@actarg.com> <21401.958492203@sss.pgh.pa.us> <21654.958494988@sss.pgh.pa.us> <200005161800.PAA21319@ant.utdt> <39218FB6.450431A8@actarg.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox