X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 810939DCA73 for ; Tue, 10 Jan 2006 11:32:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26544-02-8 for ; Tue, 10 Jan 2006 11:32:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id D3F599DCE4E for ; Tue, 10 Jan 2006 11:11:20 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EwL9a-0000Op-00; Tue, 10 Jan 2006 10:11:19 -0500 To: Andrea Arcangeli Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: NOT LIKE much faster than LIKE? References: <20060110014447.GB18474@opteron.random> <24021.1136858688@sss.pgh.pa.us> <20060110022303.GA20168@opteron.random> <24372.1136861684@sss.pgh.pa.us> <20060110034721.GC20168@opteron.random> In-Reply-To: <20060110034721.GC20168@opteron.random> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 10 Jan 2006 10:11:18 -0500 Message-ID: <87y81oyv6x.fsf@stark.xeocode.com> Lines: 21 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.116 required=5 tests=[AWL=0.116] X-Spam-Score: 0.116 X-Spam-Level: X-Archive-Number: 200601/89 X-Sequence-Number: 16567 Andrea Arcangeli writes: > Fixing this with proper stats would be great indeed. What would be the > most common value for the kernel_version? You can see samples of the > kernel_version here http://klive.cpushare.com/2.6.15/ . That's the > string that is being searched against both PREEMPT and SMP. Try something like this where attname is the column name and tablename is, well, the tablename: db=> select most_common_vals from pg_stats where tablename = 'region' and attname = 'province'; most_common_vals ------------------ {ON,NB,QC,BC} Note that there's a second column most_common_freqs and to do this would really require doing a weighted average based on the frequencies. -- greg