Re: [PATCH] backend: compare word-at-a-time in bcTruelen

From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Marko Kreen <markokr(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeremy Kerr <jk(at)ozlabs(dot)org>, "<pgsql-hackers(at)postgresql(dot)org>" <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Date: 2009-06-18 13:09:58
Message-ID: 4A3A3CA6.2080106@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> On Thu, 2009-06-18 at 15:14 +0300, Marko Kreen wrote:
>> On 6/18/09, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>>> On Tue, 2009-06-16 at 10:23 -0400, Tom Lane wrote:
>>> > Speaking of which, what about some performance numbers? Like Heikki,
>>> > I'm quite suspicious of whether there is any real-world gain to be had
>>> > from this approach.
>>>
>>>
>>> It has been "lore" for some time that VARCHAR is cheaper than
>>> VARCHAR(n), so I'm looking forward to this improvement as a real-world
>>> gain. (If done right).
>>>
>>> I've looked at the code and the thing that bothers me is that I can't
>>> see where or why bcTruelen would be called more often for VARCHAR(n)
>>> than it would be for VARCHAR, on a Select/Sort only workload.
>> I'd guess plain VARCHAR simply does not have blanks at the end,
>> so Truelen is cheap.
>
> If we were comparing CHAR(n) with VARCHAR then I could agree. But we are
> comparing VARCHAR(n) and VARCHAR. There is no blank padding with
> VARCHAR, and the two have identical on-disk representations so the cost
> of bcTruelen looks like it should be identical in each case.

the testcase discusses here is indeed CHAR(n) vs. VARCHAR. To reiterate
- my numbers(8core/16 thread Nehalem xeon with 16 processes) are
46000qps for CHAR(n), 52000 qps for CHAR(n) with Jeremys patch(thout
bcTrueLen is still on top in the profile) and 67000 qps for VARCHAR.

Stefan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-06-18 13:21:39 Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Previous Message Simon Riggs 2009-06-18 13:08:05 Re: [PATCH] backend: compare word-at-a-time in bcTruelen