Re: Lack of index usage when doing array casts

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexey Klyukin <alexk(at)hintbits(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Lack of index usage when doing array casts
Date: 2014-02-21 19:04:57
Message-ID: 5576.1393009497@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Alexey Klyukin <alexk(at)hintbits(dot)com> writes:
> We had a problem with PostgreSQL not using an index scan in 2 similar
> queries, the only difference between them is the array cast from text[] to
> location_type[] (array of enum values).

Hmm. IIRC the text to enum cast is considered stable not immutable, which
is why that doesn't get folded to a Const on sight. However, it seems
like it'd be okay for scalararraysel() to reduce stable expressions for
estimation purposes, ie it should be using estimate_expression_value.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2014-02-21 22:12:01 Re: Lack of index usage when doing array casts
Previous Message Alexey Klyukin 2014-02-21 18:01:09 Lack of index usage when doing array casts