Reputation: 1889
I want to run a SQL every time that my Postgresql cluster starts.
What is the best approach? Modify the start script? Or the PostgreSQL contains some functionality to run?
I use PostgreSQL default install on Ubuntu.
The scenario is: I run the pg_prewarm()
function that do the warm
table permanently on memory, speeding up the results but, if my DB stops or restart for some reason, I need to run this script manually.
Upvotes: 0
Views: 75
Reputation: 44147
If you are using Postgres 11 or better, pg_prewarm
has a pg_prewarm.autoprewarm
feature.
For earlier versions, you could try to re-invent this yourself, but I wouldn't recommend it. Spend the time upgrading rather than working around limitations imposed by not upgrading.
Upvotes: 1