JSON columns in Postgres are so useful, but so are other data types. What is the next data type that you want us to go deep on? Let us know in the comment below 👇
Nice one Tyler and thank you for the primer. I'm currently looking into using Postgres JSON in a Django project which will potentially greatly simplify the querying. I have a huge db of products in product classes, each class with its own set of unique attributes which need to be searchable. It will have a large global userbase, so I have to get this decision right. You have been a big help. Cheers from Sydney - Dave
A great use case for JSON in the SQL database can be a column which stores set of settings for something like custom styles. Let's say you have 3 styles that your user can customize and you want to store them in the database. For example, custom background color, font-size and font-weight. You can create a JSON object to store all these settings without having to create columns for each in a new table and create a relationship between the user. Also, if you create a JSON object for your user's settings, you can manipulate it way easier, add new styles in the future even if they are 20 more and do not need to worry about the performance, and best of all 👉🏻 All is possible without creating a mess in your db.
how big can these objects go and still be performant? I'm working on a system that has some really big json documents tracking interactions but we have migrated to a postgreSQL DB from a mongo DB and now we aren't sure if we can handle the big documents in our collections. Any advice?
With proper indexes, the difference in speed of querying data from a joined table and jsonb column are negligible. Writing is the same, generally the performance difference should be negligible. You should choose whether to use JSONB or not depending on wha tthe data could look like. If you want to be a bit more flexible with the schema of the data, you can choose to use JSONB.
I swear nothing was AI generated 😂 Maybe the bad sound quality at the intro and outro are making you feel that way. I will try to improve it on the next recording!
@@dshukertjr The sound quality is really good. I think he just means your voice is so peaceful and well-measured that it seems as if an A.I. super intelligence is responsible for it.
JSON columns in Postgres are so useful, but so are other data types. What is the next data type that you want us to go deep on? Let us know in the comment below 👇
Clear explanation, appropriate examples, looking forward to an example explaining the use of JSONB in a chat session application.
Where I think supabase really shines is using postgres json functions like json_agg() and row_to_json() to create nested structures.
Nice one Tyler and thank you for the primer. I'm currently looking into using Postgres JSON in a Django project which will potentially greatly simplify the querying. I have a huge db of products in product classes, each class with its own set of unique attributes which need to be searchable. It will have a large global userbase, so I have to get this decision right. You have been a big help. Cheers from Sydney - Dave
A great use case for JSON in the SQL database can be a column which stores set of settings for something like custom styles. Let's say you have 3 styles that your user can customize and you want to store them in the database. For example, custom background color, font-size and font-weight. You can create a JSON object to store all these settings without having to create columns for each in a new table and create a relationship between the user. Also, if you create a JSON object for your user's settings, you can manipulate it way easier, add new styles in the future even if they are 20 more and do not need to worry about the performance, and best of all 👉🏻 All is possible without creating a mess in your db.
User preferences are a great use case for using JSONB columns!
NextJS14 + Supabase + ShadCN + TailwindCSS = The Big Guy
Nice explanation, thank you!
Glad to hear you found it helpful!
how big can these objects go and still be performant?
I'm working on a system that has some really big json documents tracking interactions but we have migrated to a postgreSQL DB from a mongo DB and now we aren't sure if we can handle the big documents in our collections.
Any advice?
This was awesome!
Great video!
Thanks.
Seems we can wrap no sql into sql world.
Best of both ❤️
How would performance impact the search and database writing when using jsonb vs regular columns?
With proper indexes, the difference in speed of querying data from a joined table and jsonb column are negligible. Writing is the same, generally the performance difference should be negligible. You should choose whether to use JSONB or not depending on wha tthe data could look like. If you want to be a bit more flexible with the schema of the data, you can choose to use JSONB.
can you fo joins?
Yes, you can join a table with another table using JSON values too!
Is it just me or does the voice sound AI generated?
I swear nothing was AI generated 😂 Maybe the bad sound quality at the intro and outro are making you feel that way. I will try to improve it on the next recording!
@@dshukertjr The sound quality is really good. I think he just means your voice is so peaceful and well-measured that it seems as if an A.I. super intelligence is responsible for it.
@@punkgurutv That is so sweet of you!