zubkov-andrei / pg_profile

Postgres historic workload reports
Other
212 stars 31 forks source link

Can not install pg_profile on AWS RDS without manual modifications #87

Closed portnov closed 4 months ago

portnov commented 4 months ago

Hello.

As far as I understood from README, it should be enough to do make USE_PGXS=y sqlfile to make a script, which would install pg_profile to AWS RDS. However, when we tried that, the script did not work. We had to do the following manual changes in it:

  1. Optional: Add

    \set ON_ERROR_STOP on

    in the beginning just to make sure that in case of any error the script would stop instead of skipping errors.

  2. Optional: Add

    set search_path = profile; -- or another schema

    in the beginning, to install it to schema other than public. I believe this should be done almost in all cases for pg_profile.

  3. Comment out lines mentioning ALTER EXTENSION, like

    EXECUTE format('ALTER EXTENSION pg_profile DROP TABLE last_stat_kcache_srv%1$s',
      dserver_id);

    as there will be no extension in RDS.

  4. In collect_obj_stats function, before

    PERFORM dblink_connect('server_db_connection',db_connstr);

    add

    continue when db_connstr like '%rdsadmin%';

    This is required, because pg_hba rules in RDS reject any connection to rdsadmin database.

Could these changes be made in pg_profile distribution, so that it would be possible to use it on AWS RDS without manual modifications?

zubkov-andrei commented 4 months ago

Hi Ilya!

Thank you for this report. I'll include your fixes in a script during a week or two. point 1 and 3 should be implemented, but point 2 seems to be done outside of a script - I don't think it is a good idea to bind a schema inside the script. Point 4 looks as similar binding. To address this issue there is a database exclusion list for every server in a pg_profile installation. See the _set_server_dbexclude() function at Managing servers

portnov commented 4 months ago

Thanks for quick reply! We will try using set_server_db_exclude().

zubkov-andrei commented 4 months ago

Please check the current master branch, or _manual file of the last release. The last commit should fix points 1 and 3. I think point 2 (setting search_path) should be done just before script execution during install. It seems set_server_db_exclude() function should be called also during install just after the script.

portnov commented 4 months ago

@zubkov-andrei , we can confirm that the script generated from master branch is working now. Thank you!

portnov commented 4 months ago

I think this issue can be closed then.