Re: [pgsql-performance] Large databases, performance - Mailing list pgsql-general

From Tom Lane
Subject Re: [pgsql-performance] Large databases, performance
Date
Msg-id 19697.1034170370@sss.pgh.pa.us
Whole thread Raw
In response to Re: Large databases, performance  (Manfred Koizar <mkoi-pg@aon.at>)
Responses Re: [pgsql-performance] Large databases, performance  ("Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>)
problem with the Index  ("Jose Antonio Leo" <jaleo8@storelandia.com>)
Re: [pgsql-performance] Large databases, performance  (Manfred Koizar <mkoi-pg@aon.at>)
List pgsql-general
Manfred Koizar <mkoi-pg@aon.at> writes:
> here is an implementation of a set of user types: char3, char4,
> char10.

Coupla quick comments on these:

> CREATE FUNCTION charNN_lt(charNN, charNN)
>     RETURNS boolean
>     AS '$libdir/fixchar'
>     LANGUAGE 'c';

> bool
> charNN_lt(char *a, char *b)
> {
>     return (strncmp(a, b, NN) < 0);
> }/*charNN_lt*/

These functions are dangerous as written, because they will crash on
null inputs.  I'd suggest marking them strict in the function
declarations.  Some attention to volatility declarations (isCachable
or isImmutable) would be a good idea too.

Also, it'd be faster and more portable to write the functions with
version-1 calling conventions.

Using the Makefile to auto-create the differently sized versions is
a slick trick...

            regards, tom lane

pgsql-general by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: How to find out about index
Next
From: Tom Lane
Date:
Subject: Re: Installing PL/Python (progress!)