From: | Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu> |
---|---|
To: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
Cc: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Interesting speed anomaly |
Date: | 2005-12-15 22:59:19 |
Message-ID: | 43A1F547.3080308@dunaweb.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jim C. Nasby írta:
>Those queries aren't the same though. The view is equivalent to
>
>SELECT *
>FROM
> (select 'AAA' AS prefix,id from table 1
> union select 'AAA',id from table 2
> ) view
>WHERE prefix||id = '...'
>
>In this case the prefixes have already been unioned together, so there's
>no chance for the planner to use the function index.
>
>If break the WHERE clause into seperate clauses, such as
>
>WHERE prefix='AAA' AND id = '2005000001'
>
>then I think the planner will know what selects it can simply ignore. If
>that doesn't work, then add 'AAA'||id AS fullid to each of the selects
>in the view and that should allow the function indexes to be used.
>
>
Thanks, both method sworks very fast now and use the expression indexes.
Thanks for the patience and the explanations.
Best regards,
Zoltán Böszörményi
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-12-15 23:06:21 | Re: Which qsort is used |
Previous Message | Greg Stark | 2005-12-15 22:46:08 | Re: Which qsort is used |