JSON, JSONB questions

Поиск
Список
Период
Сортировка
От Tom C
Тема JSON, JSONB questions
Дата
Msg-id CACjqFnqGYmsxVutLEmwUVuNYvF+jcv4qu=gW1793Syk=EBp0vA@mail.gmail.com
обсуждение исходный текст
Ответы Re: JSON, JSONB questions  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-novice
I'm new to Postgres so forgive me if these are dumb question.

I'm trying to understanding why you would use JSON over JSONB. From what I have seen so far, JSONB doesn't take that much more space than JSON and offers better indexing and search capabilities than plain JSON data type. Is it really just about preserving whitespace and structure? If that was the case then why bother having the JSON data type at all? Why not just stick with varchar

Second question is around indexing and searching on data types of JSONB. I understand that you can create indexes for specific fields within the JSON. Is there a performance penalty when adding indexes to specific fields in large JSON payload? For example, let's say I have a very complex nested JSON payload stored in a JSONB column. All I'm interested in indexing is a collection array within the JSON payload. Will it be more efficient if I break out the array into a separate JSONB column?

Third and final question is how do you create an index into for an array element within the JSONB structure?

Thanks.

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

Предыдущее
От: amul sul
Дата:
Сообщение: Re: SELECT FOR UPDATE returns zero rows
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: JSON, JSONB questions