Search Postgresql Archives

ORDER BY for jsonb

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

 



Hi,

I am new to PostgreSQL and have a question about the new jsonb type in 9.4. Suppose I have a table called "user" that has two columns: (1) "user_id" of type text, also the primary key, (2) "setting" of type jsonb. With the following query pattern:

SELECT *
FROM user
WHERE user_id IN [...]
ORDER BY setting->>'foo',
         setting->>'bar',
         ...

where ORDER BY clause can contain an arbitrary list of root-level fields in "setting". In this case, how should I create indexes for "user" to get good query performance? 

Thanks,
Pai-Hung

[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