Re: [HACKERS] having and union in v7beta - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] having and union in v7beta
Date
Msg-id 239.951848861@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] having and union in v7beta  (Jose Soares <jose@sferacarta.com>)
List pgsql-hackers
Jose Soares <jose@sferacarta.com> writes:
>> But it's tough to believe that that accounts for a 3-to-4x
>> slowdown of this query; certainly I don't see much performance
>> difference on the datatypes I tried.  What datatypes are your fields,
>> anyway?

> 6.5 takes 0.463s
> 7.0 takes 1.640s
> the field type is CHAR(4)

Hmm.  I see no more than a few percent difference between 6.5 and
current.  There's something peculiar going on on your system.

Current code would ultimately invoke strncmp() on the two char fields,
whereas 6.5 used memcmp().  Is it possible that strncmp() is a huge
performance dog on your platform?  I assume you are running in a
non-ASCII locale, which might reduce strncmp's performance, but still...

A quick-and-dirty way for you to check this would be to change the
strncmp call to call memcmp (just the one-word change should work)
in bpchareq() in src/backend/utils/adt/varchar.c, and see if that
changes the performance of this query materially.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Massimo Dal Zotto
Date:
Subject: Re: [HACKERS] Syslog and pg_options (for RPMs)
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] Re: NOT {NULL|DEFERRABLE} (was: bug in 7.0)