Re: Explain is slow with tables having many columns - Mailing list pgsql-performance

From Andres Freund
Subject Re: Explain is slow with tables having many columns
Date
Msg-id 20180924195048.7dhnjvq5ggwjtiwi@alap3.anarazel.de
Whole thread Raw
In response to Explain is slow with tables having many columns  (legrand legrand <legrand_legrand@hotmail.com>)
List pgsql-performance
Hi,

(CCing -hackers)

On 2018-09-24 12:22:28 -0700, legrand legrand wrote:
> I have found that explain on tables with many (hundreds) columns
> are slow compare to nominal executions.

Yea, colname_is_unique() (called via make_colname_unique()) is
essentially O(#total_columns) and rougly called once for each column in
a select list (or using or ...).  IIRC we've hit this once when I was at
citus, too.

We really should be usign a more appropriate datastructure here - very
likely a hashtable.  Unfortunately such a change would likely be a bit
too much to backpatch...

Greetings,

Andres Freund


pgsql-performance by date:

Previous
From: legrand legrand
Date:
Subject: Re: Explain is slow with tables having many columns
Next
From: Andres Freund
Date:
Subject: Re: Explain is slow with tables having many columns