Re: PostgreSQL Views Where Clause Character Columns getting Typecasted to Text and Indexes not getting Used
От | Tom Lane |
---|---|
Тема | Re: PostgreSQL Views Where Clause Character Columns getting Typecasted to Text and Indexes not getting Used |
Дата | |
Msg-id | 1556144.1616735293@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | PostgreSQL Views Where Clause Character Columns getting Typecasted to Text and Indexes not getting Used (Jagmohan Kaintura <jagmohan@tecorelabs.com>) |
Ответы |
Re: PostgreSQL Views Where Clause Character Columns getting Typecasted to Text and Indexes not getting Used
|
Список | pgsql-general |
Jagmohan Kaintura <jagmohan@tecorelabs.com> writes: > When we are compiling View definition into database , the where clause on > the Character Columns is getting internally typecasted to text. That's normal. In Postgres, varchar has no operators of its own; everything you might do with it involves a (no-cost) cast to text. You might think of varchar as being a domain over text, though for historical reasons it's not implemented exactly that way. > These Columns are Primary Key columns and because of this Type Casting on > those columns Index scan is not happening and we are always getting > Sequential Scan. This, on the other hand, is just nonsense. You haven't presented any examples in which an indexscan looks likely to be a win. Postgres generally won't bother with an index when scanning a tiny table. Nor is an index necessarily helpful when doing a join, unless the join is designed to access just a small part of the table. > Please help us in identifying the solution. Please read https://wiki.postgresql.org/wiki/Slow_Query_Questions regards, tom lane
В списке pgsql-general по дате отправления: