Search Postgresql Archives

Re: hstore equality-index performance question

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

 



Stefan Keller <sfkeller@xxxxxxxxx> writes:
> I'm trying to optimize the latter query:
> # SELECT id, (kvp->'a') FROM mytable WHERE kvp ? 'a';

The hstore gist and gin opclasses contain support for that.

> ...or something like this (which also involves the '->' operator)
> # SELECT id FROM mytable WHERE (kvp->'a') = 'x';

You could transform this into a gist/gin indexable query

	kvp @> ('a' => 'x')

although I think the actually indexed part of it is just the search for
rows that contain key 'a', so it's not really any better than

	kvp ? 'a' AND (kvp->'a') = 'x'

performance-wise.

			regards, tom lane

-- 
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