Created
August 7, 2023 09:28
-
-
Save benoittgt/1c7e50ce6a51e06f11501f79e4704a04 to your computer and use it in GitHub Desktop.
How to fetch slower queries in postgresql logs (from RDS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You well get query that greater than 5000ms with the next line that as often query parameter if you use prepared statements. This commande requires ripgrep. | |
rg --pcre2 '[6-9][0-9][0-9][0-9]\.[0-9][0-9][0-9] ms.*' -A=1 | |
Get queries that timeout, exclude the one with a COUNT but with a filter on `rented_at` | |
rg --pcre2 'STATEMENT: SELECT(?:(?!COUNT).)*rented_at >' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment