Please don't top post on this mailing list: https://wiki.postgresql.org/wiki/Mailing_Lists#Email_etiquette_mechanics On Sun, Jun 4, 2023 at 7:42 PM Satalabaha Postgres <satalabaha.postgres@xxxxxxxxx> wrote: > > Yes both in both the cases the same tables are accessed. Yes we tried indexing as well, but we have the same behaviour. Do you reproduce the problem if you connect and execute that query manually with the schema1_u user? Is the query always fast when running as postgres and always slow when running as schema1_u? Is there any special configuration for that user? \drds can tell you that, but those should get logged with the rest of the non default parameters already displayed in the explain plan. If you can reproduce easily, you should be able to get the execution plans of the underlying FK queries using auto_explain and auto_explain.log_nested_statements = true. It might show you the problem.