Re: Regex query not using index

From: Chris <dmagick(at)gmail(dot)com>
To: Postgres User <postgres(dot)developer(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Regex query not using index
Date: 2008-02-20 06:05:49
Message-ID: 47BBC33D.6040500@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgres User wrote:
> by the way, your example works fine unless it's a null value or empty string
> unfortunately, postgres isn't smart enough to know that the when
> p_param below is null, that the WHERE condition can be ignored
>
> select * from table where name in (Coalesce(p_param, name))
>
> which is the same as: select * from table where name in (name)
>
> postgres does a row scan on the above sql. too slow.

If there's no where condition, postgres has to do a seq-scan anyway so
your argument is void :)

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message H.Harada 2008-02-20 06:16:52 Re: ERROR: relation with OID 1322527 does not exist
Previous Message Postgres User 2008-02-20 05:58:36 Re: Regex query not using index