Aurora Postgress 12.6 Purpose: schedule to rebuild all indexes. what I did is create a function that calls all tables names and reindex concurrently and put the function in pg_cron but it gives me the error "SQL Error [25001]: ERROR: REINDEX CONCURRENTLY cannot be executed from a function". How can I archive the purpose?
Thanks
Don't do it. There is usually never a need to rebuild indexes.
You can test the indexes regularly using pgstatindex
from the pgstattuple
extension if you are worried.