Sample Header Ad - 728x90

Permission denied for index idx_my_index on using pg_prewarm

3 votes
1 answer
96 views
I work on a project that uses PostgreSQL. Some analytic queries take a lot of time, and we would like to prewarm two indexes and one table. Here are the prewarming queries: - SELECT pg_prewarm('idx_my_first_index'); - SELECT pg_prewarm('idx_my_second_index'); - SELECT pg_prewarm('public.my_table'); The prewarm on the table works perfectly, but we encounter a PostgreSQL error for the prewarm on indexes. Here is the error using psql logged in the web process user:
ERROR:  permission denied for index idx_my_index
The PostgreSQL user who creates tables and indexes is different from the one who accesses the database in our web process. The user who runs migrations owns everything in the database, and the other user can write and read every table. We can prewarm the table, but when it comes to prewarm indexes, we have a permission error. ## The question is : What privilege would we give to our web process user to prewarm indexes created by another user? ## What I did I looked in the Postgresql documentation, and there is nothing about indexes and privileges, and there is nothing in the pg_prewarm page documentation. I tried to create the index from the web process user, but we cannot create an index on a table we don't own. We don't want to give all the privileges to our web process user.
Asked by Emmanuel Guefif (31 rep)
Jan 7, 2025, 07:56 PM
Last activity: Jan 8, 2025, 10:47 AM