Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 5D8FA65021E for ; Wed, 26 Nov 2008 15:40:48 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 38680-02 for ; Wed, 26 Nov 2008 15:40:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-out.neti.ee (smtp-out.neti.ee [194.126.126.44]) by mail.postgresql.org (Postfix) with ESMTP id 9D62D65014C for ; Wed, 26 Nov 2008 15:40:44 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by MXR-13.estpak.ee (Postfix) with ESMTP id 358BA307DA; Wed, 26 Nov 2008 21:40:41 +0200 (EET) X-Virus-Scanned: amavisd-new at !change-mydomain-variable!.example.com Received: from smtp-out.neti.ee ([127.0.0.1]) by localhost (MXR-1.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SFDe1AgELJ+d; Wed, 26 Nov 2008 21:40:40 +0200 (EET) Received: from Relayhost3.neti.ee (relayhost3.estpak.ee [88.196.174.169]) by MXR-13.estpak.ee (Postfix) with ESMTP id 74C5830631; Wed, 26 Nov 2008 21:40:40 +0200 (EET) X-SMTP-Auth-NETI-Businesmail: no Received: from andrusnotebook (unknown [195.50.198.194]) by Relayhost3.neti.ee (Postfix) with SMTP id B14BED4C61; Wed, 26 Nov 2008 21:40:38 +0200 (EET) Message-ID: From: "Andrus" To: "Richard Huxton" Cc: , References: <492A7591.3000700@archonet.com> <492D27C8.7090206@archonet.com> <4936D68EF8C84087BBB9212C4019D5D8@andrusnotebook> <492D9E78.9080902@archonet.com> In-Reply-To: <492D9E78.9080902@archonet.com> Subject: Re: Increasing pattern index query speed Date: Wed, 26 Nov 2008 21:40:30 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="windows-1257"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=STOX_REPLY_TYPE=0.001 X-Spam-Level: X-Archive-Number: 200811/265 X-Sequence-Number: 31996 Richard, > And the results were? Results are provided in bottom of the message to which you replied. > 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' 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. Andrus.