Re: NOT LIKE much faster than LIKE?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Andrea Arcangeli <andrea(at)cpushare(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: NOT LIKE much faster than LIKE?
Date: 2006-01-10 15:11:18
Message-ID: 87y81oyv6x.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


Andrea Arcangeli <andrea(at)cpushare(dot)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}

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Creager 2006-01-10 15:17:05 Re: Index isn't used during a join.
Previous Message Charles A. Landemaine 2006-01-10 14:41:27 How to handle a large DB and simultaneous accesses?