Re: Composite types questions

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Composite types questions
Date: 2010-01-11 18:21:07
Message-ID: 3eff28921001111021k5ab79f54ufe47496cb7031db3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/11 Merlin Moncure <mmoncure(at)gmail(dot)com>:
> On Mon, Jan 11, 2010 at 11:08 AM, Vincenzo Romano > SELECT * FROM master_tab
>>  WHERE col1>='a date':timestamp AND col1<'another date'::timestamp
>> AND col2=42 AND col3='the answer';
>
> queries of this sort are optimally handled via row constructor for 8.2 onwards:
>
> create index col231_idx  on master_tab(col2, col3, col1);
>
> select * from master_tab where (col2,col3,co1) >= (42, 'the answer',
> a_date) and (col2,col3,co1) < (42, 'the answer', b_date);
>
> one caveat: the planner is lousy in regards to estimating index
> selectivity in these cases which can cause strange behaviors.
>
> regarding constraint_exclusion, I don't think there are any
> issues...you should test it to be sure.
>
> merlin
>

Great news for me!
Thanks Merlin ... the Wizard! :-)

--
Vincenzo Romano
NotOrAnd Information Technologies
cel. +39 339 8083886 | gtalk. vincenzo(dot)romano(at)notorand(dot)it
fix. +39 0823 454163 | skype. notorand.it
fax. +39 02 700506964 | msn. notorand.it
NON QVIETIS MARIBVS NAVTA PERITVS

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2010-01-11 18:32:36 Re: Database size
Previous Message Merlin Moncure 2010-01-11 18:19:10 Re: Composite types questions