Skip site navigation (1) Skip section navigation (2)

Re: Increasing pattern index query speed

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: mweilguni(at)sime(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Increasing pattern index query speed
Date: 2008-11-26 19:54:53
Message-ID: 492DA98D.4050704@archonet.com (view raw or flat)
Thread:
Lists: pgsql-performance
Andrus wrote:
> Richard,
> 
>> And the results were?
> 
> Results are provided in bottom of the message to which you replied.

No - the explains there were contrasting a date test BETWEEN versus =.

>> One problem at a time. Let's get the pattern-matching speed problems on
>> your live server sorted, then we can look at different queries.
> 
> First message in this thread described the issue with query having
> additional condition
> 
> AND dok.kuupaev BETWEEN '2008-11-21' AND  '2008-11-21'

Ah, I think I understand. The test case was *missing* this clause.

> It seems that this problem occurs when pattern matching and BETWEEN
> conditions are used in same query.
> 
> According to Scott Garey great recommendation I added
> 
> ALTER TABLE rid ALTER COLUMN toode SET STATISTICS 1000;
> 
> This fixes testcase in live server, see my other message.
> Is it OK to run
> 
> ALTER TABLE rid ALTER COLUMN toode SET STATISTICS 1000
> 
> in prod database or should I try to decrease 1000 to smaller value ?
> rid is big increasing table and is changed frequently, mostly by adding
> rows.

This will try to track the 1000 most-common values of "toode", whereas
the default is to try to track the most common 10 values. Tracking more
values means the planner has more accurate information but makes ANALYSE
take longer to run, and also makes planning each query take slightly longer.

Try 100, 200, 500 and see if they work *for a range of queries* -
there's no point in having it much higher than it needs to be.

-- 
  Richard Huxton
  Archonet Ltd

In response to

pgsql-performance by date

Next:From: AndrusDate: 2008-11-26 20:20:52
Subject: Re: Increasing pattern index query speed
Previous:From: AndrusDate: 2008-11-26 19:45:27
Subject: Re: Increasing pattern index query speed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group