Re: Is it possible and worthy to optimize scanRTEForColumn()?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is it possible and worthy to optimize scanRTEForColumn()?
Дата
Msg-id 9069.1512745517@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Is it possible and worthy to optimize scanRTEForColumn()?  (Rui Hai Jiang <ruihaijiang@msn.com>)
Ответы Re: Is it possible and worthy to optimize scanRTEForColumn()?  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Rui Hai Jiang <ruihaijiang@msn.com> writes:
> When I run a select query, e.g. select id from t,  all columns in table "t" are checked to see if a column named "id"
existsor not, and a Var is created for "id" if the column does exist. 

> Function scanRTEForColumn() does this job.

> But I see in scanRTEForColumn(), the loop does not stop when a match is found, it continues to compare all other
columns.And this will waste lots of computing. 

> I guess there may be some reasons for this. But I don't know yet.

It's necessary because we have to check whether the column name is
ambiguous.  Although in the case of a table, the names are constrained
to all be different, this is not the case for all RTE types ... nor
even for table RTEs, if aliases have been applied.

I'm not particularly concerned about it --- I've not seen profiles
suggesting that that function is a big time sink.  Tables with very
many columns tend to be inefficient for lots of reasons, and I rather
doubt that this particular place is the first thing to hit if you
want to make that better.

            regards, tom lane


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: proposal: alternative psql commands quit and exit
Следующее
От: Ryan Murphy
Дата:
Сообщение: Re: proposal: alternative psql commands quit and exit