Search Postgresql Archives

Re: indexed range queries on jsonb?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/26/14 3:30 PM, Larry White wrote:


> 
> Logically, what I want is to be able to make queries like this:
> 
>     select * from document where ((payload->'intTest'))> 5;
> 
> With casting, I came up with:
> 
>     select * from document where (((payload->'intTest'))::text)::integer
>     > 5;
> 
> But this query does not use the index according to Explain
> 

I have not tested this with a jsonb property but you should be able to
define an index over payload->'intTest'::integer using an expression
index, described here:

http://www.postgresql.org/docs/9.1/static/indexes-expressional.html

Christian


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux