Re: Planning without reason. - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Planning without reason.
Date
Msg-id 20060623131447.GD8900@svana.org
Whole thread Raw
In response to Planning without reason.  (Tzahi Fadida <Tzahi.ML@gmail.com>)
Responses Re: Planning without reason.
Re: Planning without reason.
List pgsql-hackers
On Fri, Jun 23, 2006 at 03:57:19PM +0300, Tzahi Fadida wrote:
> R contains indices but not on all attributes or not on
> all ordered subset of keys.
>
> Query example:
> (SELECT * FROM R
> WHERE a=3, b=6,. ...)
> UNION
> (SELECT * FROM R
> WHERE b=5, d=2,. ...)
> UNION
> ....
> And lots of unions.

Do you need UNION, or do you actually mean UNION ALL?

Also, couldn't you just do:

SELECT * FROM R
WHERE (a=3, b=6, ...)
OR (b=5, d=2, ...)
etc

> I am currently just writing the query as a string and open a cursor.
> Is there a simple way to use Datums instead of converting the attributes to
> strings to create a plan for SPI.
> 10x.

I imagine SPI_prepare() and SPI_execp() would be used for this.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: vacuum, performance, and MVCC
Next
From: Alvaro Herrera
Date:
Subject: Re: Overhead for stats_command_string et al, take 2