![]() ![]() In the next article, we will see how indexes work, when to use them, and cases when Postgres chooses to ignore using them.About the PHP PostgreSQL JSONB Performance Package SELECT * FROM users WHERE metadata ? 'attribute' ![]() Please note this is only for JSONB types and works for top-level attributes only. Say we have a table user with a metadata JSONB column that stores data something like this: metadata => 'Ī better and cleaner way to do it is using the ? operator. Let's take an example to understand this and the other operators. The difference is very simple, -> returns json(b) and -> returns text. I'll try to explain some common ways to do it, but if you want more information the documentation has many more examples and more precise explanations.įor most people confusion arises between -> and -> operators. PostgreSQL allows you to query in both JSON and JSONB data in tables, although there are a few operators only for JSONB. Not wanting the same fate for JSON/JSONB data types I went through a few articles and I've been thanking myself ever since. Initially, I used to be very confused about how these queries work and sort of trial and error-ed for a few months just like I used to do with CSS only to realize I started hating CSS after a while just because I never understood the basics clearly.
0 Comments
Leave a Reply. |