Re: hstore, but with fast range comparisons?

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: hstore, but with fast range comparisons?
Date: 2014-11-13 23:01:38
Message-ID: 1415919698522-5826898.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andy Colson wrote
> On 11/13/2014 3:46 PM, Guyren Howe wrote:
>> I want to do something that is perfectly satisfied by an hstore column.
>> *Except* that I want to be able to do fast (ie indexed) <, > etc
>> comparisons, not just equality.
>>
>> From what I can tell, there isn’t really any way to get hstore to do
>> this, so I’ll have to go to a key-value table. But I thought I’d ask just
>> in case I’m missing something.
>>
>
> I think your missing something.
>
> Is it one field in the hstore? Did you try an expression index?
>
> create index cars_mph on cars ( (data->'mph') );
>
> thats a btree index, which should support < and >. (Although I've never
> tried it)

With the one caveat that everything in hstore is a string so you'd probably
want to add an appropriate cast to the expression.

David J.

--
View this message in context: http://postgresql.nabble.com/hstore-but-with-fast-range-comparisons-tp5826886p5826898.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Saffron 2014-11-13 23:23:21 Performance issue with libpq prepared queries on 9.3 and 9.4
Previous Message Andy Colson 2014-11-13 22:28:56 Re: hstore, but with fast range comparisons?