Тёмный
Jimmy Angelakos
Jimmy Angelakos
Jimmy Angelakos
Подписаться
Computer scientist, author and speaker working as a Systems and Database Architect. I've worked with, and contributed to, Open Source tools for 25+ years, and I'm an active member of PostgreSQL Europe and occasional contributor to the PostgreSQL project. This channel contains talks I've given at conferences :)
Комментарии
@max0521
@max0521 21 день назад
Hey Jimmy, great talk! I have just one question, is it possible to automate this with pg_partman and pg_cron. Create one current partition and one for the next month, if we're partitioning by month and then remove the default partition which pg_partment will create and attach our legacy one? Have you done something like this?
@JimmyAngelakos
@JimmyAngelakos 9 дней назад
You don't really need pg_partman for anything, or pg_cron for that matter. You can just automate the partition management directly via cron. (I hate dependencies ;) )
@dianad150
@dianad150 4 месяца назад
Should not recommend people to rename production table in business hours. They can lose their jobs.
@JimmyAngelakos
@JimmyAngelakos 4 месяца назад
It seems there may be a misunderstanding here: The customer specifically requested this partitioning operation due to operational concerns, and each step involved was discussed and approved. Just to clarify, nobody is recommending renaming tables in production as something you should generally do. Thanks for your comment.
@SajalGaming420
@SajalGaming420 5 месяцев назад
excellent presentation
@user--142
@user--142 5 месяцев назад
Thank you!
@burakyurdakul8843
@burakyurdakul8843 5 месяцев назад
excellent talk and presentation
@panoschristeas3927
@panoschristeas3927 5 месяцев назад
At 30:02, what beer did you pick?
@JimmyAngelakos
@JimmyAngelakos 5 месяцев назад
According to my records, it would have been a youtube.com/@moonwakebeer Pale Ale
@MrMu2sS
@MrMu2sS 6 месяцев назад
Very instructive thank you
@ecognito3
@ecognito3 6 месяцев назад
In the talk you stated that pg_dump is not a backup, but never explained why. The first paragraph of the man page for pg_dump says, "pg_dump is a utility for backing up a PostgreSQL database," which seems to disagree with you. ???
@JimmyAngelakos
@JimmyAngelakos 6 месяцев назад
Thanks for your comment. pg_dump can only produce logical backups that are useless for things such as point-in-time-recovery. Moreover, it doesn't have automation, monitoring or alerting so you have to provide all those yourself. The documentation has been there since before other PostgreSQL backup tools existed, and is accurate insofar as that pg_dump *can* be used as a backup tool, but I would not consider it a good solution for your only backup method.
@md-ariful-islam329
@md-ariful-islam329 6 месяцев назад
Fantastic Your content
@dgr2215
@dgr2215 6 месяцев назад
Do you guys have any discount codes for this book @ Packt? Would love to check it out. Thanks!
@JimmyAngelakos
@JimmyAngelakos 6 месяцев назад
Thanks for your support. Packt has a discount right now on the eBook: www.packtpub.com/product/postgresql-16-administration-cookbook/9781835460580
@dgr2215
@dgr2215 6 месяцев назад
@@JimmyAngelakos Thank you very much! I look forward to reading this book.
@DavidTuron1
@DavidTuron1 7 месяцев назад
A very good book, i can recommend it to others. Thanks
@oumao
@oumao 7 месяцев назад
How I wish I could be gifted with this masterpiece.
@oumao
@oumao 7 месяцев назад
I would wish to be gifted this book by anyone!
@JimmyAngelakos
@JimmyAngelakos 7 месяцев назад
Get the book on Amazon: packt.link/6PurB
@MrMikomi
@MrMikomi 9 месяцев назад
This is really great. Many thanks for sharing.
@MrMikomi
@MrMikomi 10 месяцев назад
Very interesting, good to know that this workaround exists. Thanks.
@MrMikomi
@MrMikomi 10 месяцев назад
Great video. Thanks.
@jonzuka9746
@jonzuka9746 10 месяцев назад
Hello! Instead of the mentioned hack, which requires a priviledged operation, a virtual view of the union of the old and new table can be desirable.
@thachvungoc4254
@thachvungoc4254 Год назад
A great video, i have some questions: 1. If I my query only select by id (or ids in multiple partition table), performance is good? Do You have a real estimate for this problem? 2. My unique key such as "name", cannot use when partition by create_date. how I resolve this problem 3. Have some another table foreign key into my table, if I create new partition table, it will miss some key? 4. I want to partition date with range base quarter, with old data how I add it to partitioned_table with right parititon. In the last step I need to detach before delete ?
@aowu6310
@aowu6310 Год назад
Citus is better
@AljazVidmar
@AljazVidmar Год назад
Very nice video. The only thing I was missing is some debate around Unique indexes or/and primary keys.
@sridharramalingam329
@sridharramalingam329 Год назад
Very well explained and the example provided with details is going to help when handling huge tables for parititioning on an active DB. Thanks for this lecture, much appreciated.
@Datapassenger_prashant
@Datapassenger_prashant Год назад
buddy i wanted to learn this.. thanks aton... as i once expericend this in kusto query lang..when i was new to kql and never heard of partition
@CUXI
@CUXI Год назад
Thanks for the awesome talk. I had a query, will we ever see pg_repack or logical replication type util that will help move data without this age old procedure. With logical replication i can move the db to another db live, but that would be too much.
@JimmyAngelakos
@JimmyAngelakos Год назад
pg_repack does something different, it can't help in this case. But copying the table onto a partitioned table on another server with logical replication is not as crazy as it sounds.
@VikramKumarpage
@VikramKumarpage Год назад
Thanks a lot Jimmy Angelakos. I have a question with below scenario One huge table work_history is having composite PK (wid and seq_no) Need to be range partitioned on column work_date. Now after partition , it's PK is composite on (wid , seq_no an work_date) which is creating issue for Referenced tables as few of those doesnot have work_date column. could you please suggest some alternate way, thanks.
@JimmyAngelakos
@JimmyAngelakos Год назад
You can't have UNIQUE constraints that are not part of the partitioning key. Perhaps since it's a history table and presumably gets only inserts with those values filled in from the application, you can drop the uniqueness constraint and have the partitioning key only be work_date. You can rebuild the necessary indexes as non-unique.
@VikramKumarpage
@VikramKumarpage Год назад
@@JimmyAngelakos thankyou
@Mohit89ist
@Mohit89ist Год назад
Thanks for the nice tutorial. One query, If i set partition by range(date). And i want to create partition only when i receive data for a particular date. How can i create it on the fly
@JimmyAngelakos
@JimmyAngelakos Год назад
Postgres doesn't support dynamic partition creation out of the box. You can create partitions in advance if you script it though, and you'll only need to do it once a year.
@yousifmobark6981
@yousifmobark6981 Год назад
Really helpful material . Very Thankful for your efforts
@user-nf4nh7jx6t
@user-nf4nh7jx6t Год назад
Joke about increasing values range for the gender column is priceless 😂
@user-lj6rz6rd2w
@user-lj6rz6rd2w Год назад
Wow!! Great explainations :)
@fredericobraga85
@fredericobraga85 Год назад
Thnaks for the content. I'm not sure I understood the ""Move data to new table at our own pace" . Why are we moving old data to the new partition table? isn't that data already part of the dailytotal_legacy partition?
@JimmyAngelakos
@JimmyAngelakos Год назад
Hi, you might not want to leave the old data in one huge partition if there's a need to query it often, so it may need to be moved to smaller partitions.
@rosendo3219
@rosendo3219 Год назад
singing during the presentation....wow...!!!
@professortrog7742
@professortrog7742 Год назад
Second item: if you don’t need a time-part in a date-time, DON’T use it. Just use the date part.
@jjlouis7762
@jjlouis7762 Год назад
in a world where you dont want to attach the old table to the new tables using the method you did, Is there an alternative way ?
@JimmyAngelakos
@JimmyAngelakos Год назад
You could copy the table onto a partitioned table on another server with logical replication?
@giampaolocapelli
@giampaolocapelli Год назад
hello, I enjoyed your talk yesterday at Fosdem 2023 in Bruxelles, thanks for the interesting resources
@radoslawolech266
@radoslawolech266 Год назад
Hi, partitioning table make pg_dump work on many jobs or just one job for this table?
@JimmyAngelakos
@JimmyAngelakos Год назад
Hi, pg_dump is going to treat each partition as a separate table, so it should be able to parallelize fine with multiple jobs.
@cjbarroso
@cjbarroso Год назад
great video, very grateful for it, learnt a ton, thank you. Mandatory lecture for anyone wanting to learn about postgres partitioning.
@JimmyAngelakos
@JimmyAngelakos Год назад
Thank you so much, I'm glad it was helpful.
@Valsiphez
@Valsiphez Год назад
Slide 17. I think it should be values from ('2021-06-01', 'AAA') to ('2021-07-01', 'BAA'); as TO is exclusive; unless there is no actual AZZ for location_code
@JimmyAngelakos
@JimmyAngelakos Год назад
Thanks for your comment; you are right that it is upper bound exclusive. In this case it doesn't really matter, as this is just meant to show a common misconception due to confusing syntax.
@JogJezz
@JogJezz Год назад
update 1,7 B of rows. how about the deadtuples? autovacuum will start and it might slow down the DB performances
@JimmyAngelakos
@JimmyAngelakos Год назад
Thanks for your comment. This operation can't be done for free anyway, and that's exactly what autovacuum is there for. I would actually suggest increasing its limits before starting, because it's better to trade off a little performance than accumulate bloat. The point of this exercise is to perform a necessary action without blocking usage.
@JogJezz
@JogJezz Год назад
@@JimmyAngelakos in Our case, we use different approach to handle this data type issue with minimum downtime from apps, the downtime less than 5 mins actually
@NOPerative
@NOPerative 2 года назад
32TB is one installation of Call of Duty and a few jpegs. LOL Good vid. Data partitioning is serious stuff and a concept that I don't see being addressed frequently, so good stuff.
@milequinze
@milequinze 2 года назад
Excelent, thank you a lot!
@dulithamahishka807
@dulithamahishka807 2 года назад
How would it work in the plan when you rename the table? Doesn't the application try to find the old table name?
@JimmyAngelakos
@JimmyAngelakos 2 года назад
The renaming is transparent, you do it all in one transaction and attach the (renamed) old table as a partition of the new one.
@sanjaybhatikar
@sanjaybhatikar 2 года назад
Very helpful, thank you!
@onemanshow2441
@onemanshow2441 2 года назад
Thanks for this excellent tutorial 👍
@robertyackobian8360
@robertyackobian8360 2 года назад
Very nice. I thought I know everything there is to know and you came with the md.c file..
@nafaa-study
@nafaa-study 2 года назад
In the minute 28:19 you said that the transactions ID space is circular with a visibility horizon. I don't get what you mean exactly by "T 9999 It's visible to you (T 10000) because you can see the results". Do you mean this is depending on the isolation level in which each transaction is running? Or do you mean the results are visible if the T 9999 is committed? So from this, we know that T 10001 will not be visible no matter at what isolation level each T is running. Because even if T 10000 takes way longer to the extent that 10001 is started and committed, it still cannot see its results regardless of the isolation level.
@JimmyAngelakos
@JimmyAngelakos 2 года назад
Correct. If 9999 has committed, 10000 will be able to see its changes. But row versions with an insertion id (xmin) of 10001 can never be visible within 10000.
@isarwarfp
@isarwarfp 2 года назад
I have little confusion in last step about anonymous query block. Does all that operation would be in single transaction BEGIN; 1. rename 2. create new table and indices 3. create new partition 4. attach old partition 5. anonymous stored procedure COMMIT; ?
@JimmyAngelakos
@JimmyAngelakos 2 года назад
Hi Imran, yes, you can use an anonymous code block with DO inside a transaction block, provided you don't use transaction control statements inside the DO block.
@periclessevegnani
@periclessevegnani 2 года назад
Yeah definitely this is one of those big problems DBA encounters in large and busy environments. The solution is always painful but you described here a graceful solution. Thanks for sharing, best regards from Brazil.
@periclessevegnani
@periclessevegnani 2 года назад
Everyday I fall more in love with Postgres ! Thank you for sharing this.
@JimmyAngelakos
@JimmyAngelakos 2 года назад
Thank you!
@jirehla-ab1671
@jirehla-ab1671 4 месяца назад
​@@JimmyAngelakoswould partitioning hep with a big table thats mostly handling random updates (OLTP) r.g an acccounts tables with many users updating the account balances
@JimmyAngelakos
@JimmyAngelakos 3 месяца назад
@@jirehla-ab1671 It depends on the size of the table and what you are trying to do. If you choose a partition key that allows you to perform efficient pruning then it should help with query performance.
@isarwarfp
@isarwarfp 2 года назад
Very nice way of execution, Asking questions => Answering them. Good Work :)