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. ...

December 11, 2024 · 1 min · Özkan Pakdil

Postgresql group by day, week and month examples

at the end of any product there will be a reporting interfaces for counts. let say you build a advertisement site which gives people to publish their products on the site. they will want to see how many people visited their product in daily basis or weekly. I used to do this in mysql like this SELECT create_time as Date, count(id) as 'Count', FROM views_of_product group by date_format(create_time, '%d %m %Y') order by date_format(create_time, '%Y-%m-%d') desc limit 7 this will nicely show last seven days views. but I needed to do same thing in postgresql. and like other days its not easily to find. I should check other report codes from project but no I allways research on google :) anyway here is my code: ...

September 30, 2023 · 2 min · Özkan Pakdil