How to generate a Aurora Postgresql cluster with all auto explain enabled
PostgreSQL has query execution plans configured as extension, meaning they do not come out of the box we need to configure it, For on-prem or owning server you can check this link which tells how to configure it. Problem is there are so many steps. And it is confusing for AWS Aurora
I wrote a small bash script Here just to make this work automatic. Here is powershell version
- SubnetGroupName -> AWS subnet name for connecting which has all the configuration ready
- $psqlPath = “C:\tools\postgresql-16.6-2\pgsql\bin\psql.exe” -> user should have psql in the machine and change the path accordingly
- Before starting it, user should have aws secret and keys defined in their env variables, explained here
After successful execution you should see the test cluster like below, and you can check logs to see how execution plans are created.
And in case you wonder how explain and query plan works in detail you can check the code here study some C 🤓