Re: pg_stat_statement normalization fails due to temporary tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pg_stat_statement normalization fails due to temporary tables
Дата
Msg-id 639.1417532340@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pg_stat_statement normalization fails due to temporary tables  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: pg_stat_statement normalization fails due to temporary tables  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> pg_stat_statement's query normalization fails when temporary tables are
> used in a query. That's because JumbleRangeTable() uses the relid in the
> RTE to build the query fingerprint. I think in this case pgss from 9.1
> actually would do better than 9.2+ as the hash lookup previously didn't
> use the relid.

> I don't really have a good idea about fixing this though. The best thing
> that comes to mind is simply use eref->aliasname for the
> disambiguation...

Hmm ... by "fails" I suppose you mean "doesn't treat two different
instances of the same temp table name as the same"?  I'm not sure
that's a bug.

If we go over to using the aliasname then "select x from foo a" and
"select x from bar a" would be treated as the same query, which
clearly *is* a bug.  More generally, I don't think that schema1.tab
and schema2.tab should be considered the same table for this purpose.
So it's hard to see how to do much better than using the OID.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [v9.5] Custom Plan API
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pg_stat_statement normalization fails due to temporary tables