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 4CAB19DC9E3 for ; Tue, 10 Jan 2006 11:32:29 -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 27451-01-2 for ; Tue, 10 Jan 2006 11:32:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from opteron.random (unknown [217.133.42.200]) by postgresql.org (Postfix) with ESMTP id 066F69DD368 for ; Tue, 10 Jan 2006 11:27:17 -0400 (AST) Received: by opteron.random (Postfix, from userid 500) id DCEEB1C1BEC; Tue, 10 Jan 2006 16:27:20 +0100 (CET) Date: Tue, 10 Jan 2006 16:27:20 +0100 From: Andrea Arcangeli To: Greg Stark Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: NOT LIKE much faster than LIKE? Message-ID: <20060110152720.GL15897@opteron.random> 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> <87y81oyv6x.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y81oyv6x.fsf@stark.xeocode.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200601/86 X-Sequence-Number: 16564 On Tue, Jan 10, 2006 at 10:11:18AM -0500, Greg Stark wrote: > > 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} Thanks for the info! klive=> select most_common_vals from pg_stats where tablename = 'klive' and attname = 'kernel_version'; most_common_vals ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ {"#1 Tue Sep 13 14:56:15 UTC 2005","#1 Fri Aug 19 11:58:59 UTC 2005","#7 SMP Fri Oct 7 15:56:41 CEST 2005","#1 SMP Fri Aug 19 11:58:59 UTC 2005","#2 Thu Sep 22 15:58:44 CEST 2005","#1 Fri Sep 23 15:32:21 GMT 2005","#1 Fri Oct 21 03:46:55 EDT 2005","#1 Sun Sep 4 13:45:32 CEST 2005","#5 PREEMPT Mon Nov 21 17:53:59 EET 2005","#1 Wed Sep 28 19:15:10 EDT 2005"} (1 row) klive=> select most_common_freqs from pg_stats where tablename = 'klive' and attname = 'kernel_version'; most_common_freqs ------------------------------------------------------------------------------------------- {0.0133333,0.0116667,0.011,0.009,0.00733333,0.00666667,0.00633333,0.006,0.006,0.00566667} (1 row) klive=> There's only one preempt near the end, not sure if it would work?