Re: how to do profile for pg?
Hi, This talk from Andres seems to have some relevant information for you: https://www.youtube.com/watch?v=HghP4D72Noc -- David Geier (ServiceNow)
Re: how to do profile for pg?
This talk by D. Dolgov https://www.postgresql.eu/events/pgconfeu2022/sessions/session/3861/slides/325/Dmitrii_Dolgov_PGConf_EU_2022.pdf might be insightful. Or not, because you need to fill in a lot of blanks. Maybe you can find a recording of that talk somewhere, if you're lucky. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ #error "Operator lives in the wrong universe" ("Use of cookies in real-time system development", M. Gleixner, M. Mc Guire)
Re: how to do profile for pg?
Hi, > but I need a quick demo to see the memory profiling or CPU profiling. I hope > a blog or a video which is better for me. Thanks Well, then I guess you better hurry with reading these books :) There is no shortcut I'm afraid. One of the first things that Brendan explains is how to do benchmarks *prorerly*. This is far from being trivial and often you may be measuring not something you want. E.g. you may think that you are profiling CPU while in fact there is a lock contention and CPU is not even a bottleneck. Another thing worth considering which is often neglected is to make sure your optimization doesn't cause any digradations under different workloads. Last but not least you should be mindful of different configuration parameters of PostgreSQL - shared_buffers, synchronous_commit = off, to name a few, and also understand the architecture of the system quite well. In this context I recommend Database System Concepts, 7th Edition by Avi Silberschatz et al and also CMU Intro to Database Systems [1] and CMU Advanced Database Systems [2] courses. [1]: https://www.youtube.com/playlist?list=PLSE8ODhjZXjZaHA6QcxDfJ0SIWBzQFKEG [2]: https://www.youtube.com/playlist?list=PLSE8ODhjZXjYzlLMbX3cR0sxWnRM7CLFn -- Best regards, Aleksander Alekseev
Re: how to do profile for pg?
but I need a quick demo to see the memory profiling or CPU profiling. I hope a blog or a video which is better for me. Thanks. Replied Message From mailto:aleksan...@timescale.com; >Aleksander Alekseevaleksan...@timescale.com Date 09/21/2023 22:02 To mailto:pgsql-hackers@lists.postgresql.org; >pgsql-hackerspgsql-hackers@lists.postgresql.org Cc mailto:jack...@gmail.com; >jack...@gmail.com Subject Re: how to do profile for pg? Hi jacktby, PostgreSQL is literally a large and complicated program in C. Thus it can be profiled as such. E.g. you can use `perf` and build flamegraphs using `perf record`. Often pgbench is an adequate tool to compare before and after results.There are many other tools available depending on what exactly you want to profile - CPU, lock contention, disk I/O, etc. People write books (plural) on the subject. Personally I would recommend System Performance, Enterprise and the Cloud, 2nd Edition and BPF Performance Tools by Brendan Gregg. -- Best regards, Aleksander Alekseev
Re: how to do profile for pg?
Hi jacktby, PostgreSQL is literally a large and complicated program in C. Thus it can be profiled as such. E.g. you can use `perf` and build flamegraphs using `perf record`. Often pgbench is an adequate tool to compare before and after results.There are many other tools available depending on what exactly you want to profile - CPU, lock contention, disk I/O, etc. People write books (plural) on the subject. Personally I would recommend "System Performance, Enterprise and the Cloud, 2nd Edition" and "BPF Performance Tools" by Brendan Gregg. -- Best regards, Aleksander Alekseev