Re: Regex query not using index - Mailing list pgsql-general

From Chris
Subject Re: Regex query not using index
Date
Msg-id 47BBC33D.6040500@gmail.com
Whole thread Raw
In response to Re: Regex query not using index  ("Postgres User" <postgres.developer@gmail.com>)
List 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/

pgsql-general by date:

Previous
From: "Postgres User"
Date:
Subject: Re: Regex query not using index
Next
From: H.Harada
Date:
Subject: Re: ERROR: relation with OID 1322527 does not exist