Re: NOT LIKE much faster than LIKE? - Mailing list pgsql-performance

From Andrea Arcangeli
Subject Re: NOT LIKE much faster than LIKE?
Date
Msg-id 20060110152720.GL15897@opteron.random
Whole thread Raw
In response to NOT LIKE much faster than LIKE?  (Andrea Arcangeli <andrea@cpushare.com>)
Responses Re: NOT LIKE much faster than LIKE?
List pgsql-performance
On Tue, Jan 10, 2006 at 10:11:18AM -0500, Greg Stark wrote:
>
> Andrea Arcangeli <andrea@cpushare.com> 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
Aug19 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
EDT2005","#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?

pgsql-performance by date:

Previous
From: "Charles A. Landemaine"
Date:
Subject: How to handle a large DB and simultaneous accesses?
Next
From: Tom Lane
Date:
Subject: Re: 500x speed-down: Wrong statistics!