How to store and query JSON data in Postgres

  Рет қаралды 5,881

Supabase

Supabase

Күн бұрын

JSON and JSONB type allows you to store unstructured data in Postgres. In this video, Tyler Shukert walks you through how to store and query JSON data from your Postgres database.
Learn how to manage unstructured data through JSON and JSONB columns: supabase.com/docs/guides/data...
Postgres is a relational database, but it also has support for JSON and JSONB-type columns, which allows developers to store unstructured data. Not only can they be flexible with the data to be stored, but there are many unique operators for querying JSON data flexibly. We take a deeper look into what the possibilities are with JSON columns on Postgres.
00:00 Intro
00:26 Querying a JSON value
00:50 Arrow notation to access the properties
01:57 Create a table with JSONB type column
02:54 JSONB-operator deep dive
03:19 ? filter for contains
03:42 ?& for array contains all
03:51 ?| for array contains any
03:57 JSON contains filter
04:49 Outro
💻 Videos to watch next:
▶ FASTEST way to host a Postgres database (2024):
• FASTEST way to host a ...
▶ Generate column values in Postgres with Functions, Triggers, default values and RLS
: • Generate column values...
▶ Create PostgreSQL Functions with Supabase: • Create PostgreSQL Func...
👇 Learn more about Supabase 👇
🕸 Website: supabase.com/
🏁 Get started: app.supabase.com/
📄 Docs: supabase.com/docs
🔔 Subscribe for more tutorials and feature updates from Supabase: / @supabase
📱 Connect with Us:
🐙 Github: www.github.com/supabase
💬 Discord: www.discord.supabase.com/
🐦 Twitter: / supabase
▶ Instagram (follow for memes): / supabasecom
ABOUT SUPABASE:
Supabase is the open source Firebase alternative. Supabase provides a full Postgres database for every project with pgvector, backups, realtime, and more. Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs.
Build in a weekend, scale to millions.
#Supabase #AppDevelopment #RealtimeApps #DeveloperTools

Пікірлер: 22
@dshukertjr
@dshukertjr 2 ай бұрын
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 👇
@user-df1zf9ti2w
@user-df1zf9ti2w Ай бұрын
Clear explanation, appropriate examples, looking forward to an example explaining the use of JSONB in a chat session application.
@Jebusankel
@Jebusankel Ай бұрын
Where I think supabase really shines is using postgres json functions like json_agg() and row_to_json() to create nested structures.
@EnesKab
@EnesKab 2 ай бұрын
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.
@dshukertjr
@dshukertjr 2 ай бұрын
User preferences are a great use case for using JSONB columns!
@planetmall2
@planetmall2 2 ай бұрын
This was awesome!
@jaany
@jaany 2 ай бұрын
Great video!
@xberna8156
@xberna8156 2 ай бұрын
Nice explanation, thank you!
@dshukertjr
@dshukertjr 2 ай бұрын
Glad to hear you found it helpful!
@cariyaputta
@cariyaputta 2 ай бұрын
Thanks.
@thestereokid6073
@thestereokid6073 23 күн бұрын
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?
@vengateshm2122
@vengateshm2122 2 ай бұрын
Seems we can wrap no sql into sql world.
@Supabase
@Supabase 2 ай бұрын
Best of both ❤️
@jannickpedersen4620
@jannickpedersen4620 2 ай бұрын
NextJS14 + Supabase + ShadCN + TailwindCSS = The Big Guy
@nicolascalderon9366
@nicolascalderon9366 Ай бұрын
How would performance impact the search and database writing when using jsonb vs regular columns?
@Supabase
@Supabase Ай бұрын
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.
@jonathangamble
@jonathangamble 2 ай бұрын
can you fo joins?
@dshukertjr
@dshukertjr 2 ай бұрын
Yes, you can join a table with another table using JSON values too!
@emmanuelchucks
@emmanuelchucks 2 ай бұрын
Is it just me or does the voice sound AI generated?
@dshukertjr
@dshukertjr 2 ай бұрын
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!
@indiechatofficial
@indiechatofficial 2 ай бұрын
@@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.
@tylershukert3621
@tylershukert3621 Ай бұрын
@@indiechatofficial That is so sweet of you!
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 27 МЛН
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 59 МЛН
Even JSONB In Postgres Needs Schemas | POSETTE 2024
23:19
Microsoft Developer
Рет қаралды 218
Build an SQL Agent with Llama 3 | Langchain | Ollama
20:28
TheAILearner
Рет қаралды 2,3 М.
Firebase has SQL: Introducing Data Connect
16:29
Firebase
Рет қаралды 57 М.
Make your queries 43,240x faster
13:16
Supabase
Рет қаралды 22 М.
Are Multi-Column Indexes a good idea?
11:22
Supabase
Рет қаралды 2,1 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 793 М.
Что не так с LG? #lg
0:54
Не шарю!
Рет қаралды 84 М.
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,3 МЛН
APPLE совершила РЕВОЛЮЦИЮ!
0:39
ÉЖИ АКСЁНОВ
Рет қаралды 4,3 МЛН
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 7 МЛН