How to store and query JSON data in Postgres

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024

ความคิดเห็น • 22

  • @dshukertjr
    @dshukertjr 4 หลายเดือนก่อน +6

    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 4 หลายเดือนก่อน +1

      Clear explanation, appropriate examples, looking forward to an example explaining the use of JSONB in a chat session application.

    • @Jebusankel
      @Jebusankel 4 หลายเดือนก่อน +1

      Where I think supabase really shines is using postgres json functions like json_agg() and row_to_json() to create nested structures.

  • @EnesKab
    @EnesKab 4 หลายเดือนก่อน +5

    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 4 หลายเดือนก่อน +1

      User preferences are a great use case for using JSONB columns!

  • @xberna8156
    @xberna8156 4 หลายเดือนก่อน +3

    Nice explanation, thank you!

    • @dshukertjr
      @dshukertjr 4 หลายเดือนก่อน

      Glad to hear you found it helpful!

  • @jannickpedersen4620
    @jannickpedersen4620 4 หลายเดือนก่อน +9

    NextJS14 + Supabase + ShadCN + TailwindCSS = The Big Guy

  • @thestereokid6073
    @thestereokid6073 3 หลายเดือนก่อน +2

    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?

  • @planetmall2
    @planetmall2 4 หลายเดือนก่อน +2

    This was awesome!

  • @jaany
    @jaany 4 หลายเดือนก่อน +2

    Great video!

  • @cariyaputta
    @cariyaputta 4 หลายเดือนก่อน +2

    Thanks.

  • @vengateshm2122
    @vengateshm2122 4 หลายเดือนก่อน +8

    Seems we can wrap no sql into sql world.

    • @Supabase
      @Supabase  4 หลายเดือนก่อน +2

      Best of both ❤️

  • @nicolascalderon9366
    @nicolascalderon9366 4 หลายเดือนก่อน

    How would performance impact the search and database writing when using jsonb vs regular columns?

    • @Supabase
      @Supabase  4 หลายเดือนก่อน +1

      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 4 หลายเดือนก่อน +1

    can you fo joins?

    • @dshukertjr
      @dshukertjr 4 หลายเดือนก่อน +1

      Yes, you can join a table with another table using JSON values too!

  • @emmanuelchucks
    @emmanuelchucks 4 หลายเดือนก่อน

    Is it just me or does the voice sound AI generated?

    • @dshukertjr
      @dshukertjr 4 หลายเดือนก่อน +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 4 หลายเดือนก่อน +3

      @@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 4 หลายเดือนก่อน +1

      @@indiechatofficial That is so sweet of you!