Re: Minor inaccuracy in jsonb_path_ops documentation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Minor inaccuracy in jsonb_path_ops documentation
Дата
Msg-id 20776.1406239333@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Minor inaccuracy in jsonb_path_ops documentation  (Peter Geoghegan <pg@heroku.com>)
Ответы Re: Minor inaccuracy in jsonb_path_ops documentation  (Peter Geoghegan <pg@heroku.com>)
Список pgsql-hackers
Peter Geoghegan <pg@heroku.com> writes:
> The jsonb documentation says of the jsonb_path_ops GIN opclass:
> """
> A disadvantage of the jsonb_path_ops approach is that it produces no
> index entries for JSON structures not containing any values, such as
> {"a": {}}. If a search for documents containing such a structure is
> requested, it will require a full-index scan, which is quite slow.
> jsonb_path_ops is therefore ill-suited for applications that often
> perform such searches.
> """

> The reference to a full index scan seems questionable.

Well, if you get an indexscan, it will be a full index scan, so
I find this warning appropriate.

The fact that the planner can avoid that in the presence of a
simple constant comparison value doesn't make it a good idea to
use jsonb_path_ops indexes if you do this type of query a lot,
because in some usages the planner won't see a constant comparison
value, and if so it'll likely choose an indexscan by default.

Getting into exactly when the planner will or won't save your bacon
is the kind of detail I'd rather not put in user-facing docs.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Why does xlog.c not treat COMMIT_PREPARED/ABORT_PREPARED as commit/abort?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Why does xlog.c not treat COMMIT_PREPARED/ABORT_PREPARED as commit/abort?