Re: LIKE search and performance

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: <mark(at)mark(dot)mielke(dot)cc>, "Mark Lewis" <mark(dot)lewis(at)mir3(dot)com>, "James Mansion" <james(at)mansionfamily(dot)plus(dot)com>, "Magnus Hagander" <magnus(at)hagander(dot)net>, "Alexander Staubo" <alex(at)purefiction(dot)net>, "Andy" <frum(at)ar-sd(dot)net>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: LIKE search and performance
Date: 2007-05-25 17:58:13
Message-ID: 87y7jckcp6.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Richard Huxton" <dev(at)archonet(dot)com> writes:

> Now you and I can look at a substring and probably make a good guess how common
> it is (assuming we know the targets are British surnames or Japanese towns). PG
> needs one number - or rather, it picks one number for each length of
> search-string (afaik).

I don't think that's true. Postgres calculates the lower and upper bound
implied by the search pattern and then uses the histogram to estimate how
selective that range is. It's sometimes surprisingly good but obviously it's
not perfect.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-05-25 18:04:48 Re: How PostgreSQL handles multiple DDBB instances?
Previous Message Richard Huxton 2007-05-25 17:32:39 Re: LIKE search and performance