Re: view reading information_schema is slow in PostgreSQL 12

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: regrog <andrea(dot)vencato(at)gmail(dot)com>
Cc: postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: view reading information_schema is slow in PostgreSQL 12
Date: 2020-06-15 18:21:40
Message-ID: CAHOFxGpDPALxkCVQwVmCA0TGM5RVoDGDEqizRuRNmOgx-MQHAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Jun 12, 2020 at 12:26 PM regrog <andrea(dot)vencato(at)gmail(dot)com> wrote:

> I'm facing performance issues migrating from postgres 10 to 12 (also from
> 11
> to 12) even with a new DB.
> Th performance difference is huge 300ms in pg10 vs 3 minutes in pg12.
>
> I have a view that abstracts the data in the database:
>
> CREATE OR REPLACE VIEW public.my_constraints
>

Assuming your DDL changes fairly seldomly, and you already have a well
structured deployment process in place for that, perhaps just change this
to a materialized view and refresh (concurrently) after any DDL gets
executed. That way, you have stats on what your view has in it and are not
subject to issues with planning the execution of the query in this view.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message regrog 2020-06-16 09:23:14 Re: view reading information_schema is slow in PostgreSQL 12
Previous Message Justin Pryzby 2020-06-15 00:05:16 Re: Performance issue