Use generated columns to perform queries with formulas in a scalable way

  Рет қаралды 2,943

Supabase

Supabase

Күн бұрын

Пікірлер: 38
@dshukertjr
@dshukertjr 3 ай бұрын
We are working on series of Postgres videos on this channel right now! What other Postgres concepts would you like us to cover? Let us know in the comments blow 👇
@DinoRossYT
@DinoRossYT 3 ай бұрын
More computing actions scenarios data oriented so we can take advantage of backend all-in-one 🙏
@thibault7190
@thibault7190 3 ай бұрын
Great. Does it work with jsonb column?
@dshukertjr
@dshukertjr 3 ай бұрын
Yup, that is another awesome use case. You could extract certain values from jsonb columns as a generated column, or you could construct jsonb columns using other columns.
@akshykhade
@akshykhade 3 ай бұрын
i wasted so much time with triggers and functions for small tasks like this
@dshukertjr
@dshukertjr 3 ай бұрын
I have been there 😂
@champechilufya1458
@champechilufya1458 3 ай бұрын
Same here !!!!
@DinoRossYT
@DinoRossYT 3 ай бұрын
Same
@shmuel-k
@shmuel-k 3 ай бұрын
Geberated columns are only able to access data from the current row. So you can't use them for rollup fields or to reference another table. If you need data from another table, you're back to triggers, functions, and views
@dshukertjr
@dshukertjr 3 ай бұрын
Yup, views are awesome!
@mrrolandlawrence
@mrrolandlawrence 3 ай бұрын
persistant computed columns are awesome.
@jaguarconsultoriadigital8147
@jaguarconsultoriadigital8147 3 ай бұрын
Thanks very much.
@dshukertjr
@dshukertjr 3 ай бұрын
Glad to hear you liked it!
@brotherly9058
@brotherly9058 3 ай бұрын
How can we alter that column formula?
@Supabase
@Supabase 3 ай бұрын
You can drop the existing column and add a new one with the same name in a transaction!
@luisandrade1291
@luisandrade1291 3 ай бұрын
I wish you had shown the execution time of the before and after.
@dshukertjr
@dshukertjr 3 ай бұрын
I only had 1000 rows in this particular example, but yes, I should have prepared enough sample data so that I could demonstrate the execution time difference. Trust me though, querying millions of rows with this formula in the query will take a very long time without using a generated column!
@brotherly9058
@brotherly9058 2 ай бұрын
@@dshukertjr Using formula took me very long time to run query and very hard to maintain. I wish i knew this 3 years ago
@fawazjoseph878
@fawazjoseph878 3 ай бұрын
Awesome feature 👏🏿🙌🏿 Can you create a generated column using the supabase ui column editor
@dshukertjr
@dshukertjr 3 ай бұрын
It's not quite yet supported, but hopefully in the future!
@brotherly9058
@brotherly9058 3 ай бұрын
Thanks very much for this!!!!❤❤
@dshukertjr
@dshukertjr 3 ай бұрын
Glad you liked it!
@Hagemony
@Hagemony 2 ай бұрын
I think people should explore more on postgres powers not just storing data, thanks for this
@pluswithai
@pluswithai 3 ай бұрын
Awesome, thank you for the quality content and great service you provide.❤
@champechilufya1458
@champechilufya1458 3 ай бұрын
Is this new or has it always been there? I think computed columns might have always been a postgres thing, but this allows me to generate unique compound ids, which i can use in conflict upsert type queries. Glad i clicked
@dshukertjr
@dshukertjr 3 ай бұрын
It's relatively new as it was only introduced in Posgres 12, which was released in 2019.
@ubitubee
@ubitubee 3 ай бұрын
is there a difference, performance-wise, between this method and making functions with triggers?
@dshukertjr
@dshukertjr 3 ай бұрын
Performance-wise probably not. At least nothing significant.
@ubitubee
@ubitubee 3 ай бұрын
do one on different type of indexes and approximate string / natural language search
@dshukertjr
@dshukertjr 3 ай бұрын
Awesome suggestion! Will definitely cover the topic in the future!
@Yusuf-ok5rk
@Yusuf-ok5rk 3 ай бұрын
hey these new videos of yours are pretty good. keep up the good work. Oh also imo you should add your name + any other person that worked in the video in description.
@dshukertjr
@dshukertjr 3 ай бұрын
Great suggestion! Let me add it in!
@loucasi
@loucasi 2 ай бұрын
Amazing presenters of Supabase very informative videos! Would you PLEASE make a video explaining best practices for handling time + timezones in & out of Supabase ? If you could add some specifics regarding Flutterflow and how it handles the issue - and how the two could come together - apart from helping my particular non coder situation could be the ONE video on the internet that shows best practices and rules to handle the "time" issue once and for all. PLEASE! 🤞 😅 🤕
@flanderstruck3751
@flanderstruck3751 Ай бұрын
This was very useful. Thank you very much
@matthewbeardsley7004
@matthewbeardsley7004 Ай бұрын
This was very useful, thanks!!
@DinoRossYT
@DinoRossYT 3 ай бұрын
So not trigger or functions anymore? 😅
@dshukertjr
@dshukertjr 3 ай бұрын
If your use case can be done using generated column, you probably should use generated columns, but triggers have more capabilities than generated column such as reaching out to other tables. So the answer is "it depends"!
@DinoRossYT
@DinoRossYT 3 ай бұрын
@@dshukertjr always on point, great example u made here 🙏
Make your queries 43,240x faster
13:16
Supabase
Рет қаралды 25 М.
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 66 МЛН
Cute
00:16
Oyuncak Avı
Рет қаралды 12 МЛН
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
Firebase vs Supabase - I Built The Same App With Both
6:21
Your Average Tech Bro
Рет қаралды 115 М.
Airflow for Beginners: Build Amazon books ETL Job in 10 mins
13:13
Sunjana in Data
Рет қаралды 4,9 М.
Postgres scales … when you do this!
9:59
Supabase
Рет қаралды 4,4 М.
10 awesome Power Query tricks you NEED to know! | Excel Off The Grid
15:44
Excel Off The Grid
Рет қаралды 43 М.
What does a Data Analyst actually do? (in 2024) Q&A
14:27
Tim Joo
Рет қаралды 62 М.
#Supabase User Profile Creation on App Sign-up - Full walkthrough
18:17
The Digital Pro's NoCode Academy
Рет қаралды 16 М.
Everything you NEED TO KNOW about Relationships
13:53
Supabase
Рет қаралды 2,3 М.
Simplify complex SQL queries with Views in Postgres
26:01
Supabase
Рет қаралды 9 М.