Re: Wrong plan sequential scan instead of an index one - Mailing list pgsql-performance

From Richard Huxton
Subject Re: Wrong plan sequential scan instead of an index one
Date
Msg-id 460CF902.4020707@archonet.com
Whole thread Raw
In response to Wrong plan sequential scan instead of an index one  (Gaetano Mendola <mendola@bigfoot.com>)
Responses Re: Wrong plan sequential scan instead of an index one
List pgsql-performance
Gaetano Mendola wrote:
>
> The match 19 for '%pi%' is estimated, the real matches are:
>
> test=# select id from l_pvcp where value ilike '%pi%';
>  id
> - ----
>  62
> (1 row)
>
>
> test=#  select id from l_pvcp where value ilike 'pi';
>  id
> - ----
>  62
> (1 row)
>
> so one row in both cases, that's why I expect for both same plan.

Ah, but it's got no way of knowing what matches you'll get for
'%anything%'. There's no easy way to get statistics for matching substrings.

--
   Richard Huxton
   Archonet Ltd

pgsql-performance by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: Wrong plan sequential scan instead of an index one
Next
From: Dimitri
Date:
Subject: Re: Shared buffers, db transactions commited, and write IO on Solaris