Re: Stats for indexes on expressions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Stats for indexes on expressions
Дата
Msg-id 1135857.1608876542@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Stats for indexes on expressions  (Shantanu Shekhar <shekharshan@yahoo.com>)
Список pgsql-general
Shantanu Shekhar <shekharshan@yahoo.com> writes:
> I am trying to understand how the cost for a query involving indexes on expressions is calculated. How is the
statisticson the expression maintained? For example Postgres documentation on 'Indexes on Expressions' mentions the
followingexample: 
> CREATE INDEX people_names ON people ((first_name || ' ' || last_name));SELECT * FROM people WHERE (first_name || ' '
||last_name) = 'John Smith'; 
> The index is created on an expression involving first name and last name. My confusion is basically around:
> (1) When using this index how will the query planner get the stats on this expression?

ANALYZE on a table will (re)build statistics for any expression indexes on
that table, in addition to the stats for the table's own columns.

(2) Whenever an index on an expression is defined like this, should we rebuild the stats?

If you don't want to wait around for auto-analyze to do it, yes.

            regards, tom lane



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

Предыдущее
От: Shantanu Shekhar
Дата:
Сообщение: Stats for indexes on expressions
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: How to specify that a trigger should fire when column is NOT in SET-clause?