Hi, I'm a newbie to postgresql, and I have 2 questions.

1. shared memory hash key is string.
why don't we use predefined integer value?
I think it is dangerous to use string for key value,
because it can be mistyped , which might lead us to debug more and more.

2. appendStringInfoChar reallocates every bytes whenever needed,
why don't reallocate chunk for better performace?
because initStringInfo allocates only 256 bytes ,
pg_beginmessage prepared 256 bytes of StringInfo for communication buffer.

It's hard to analyze pgsql source code,
because I'm a newbie, and have no idea about postgres internals,
But I will try hard!! 

Thank you.








Hi, I'm a newbie to postgresql, and I have 2 
questions.
 
1. shared memory hash key is string.why don't we use 
predefined integer value?I think it is dangerous to use string for key 
value,because it can be mistyped , which might lead us to debug more and 
more.
 
2. appendStringInfoChar reallocates every bytes whenever 
needed,why don't reallocate chunk for better performace?because 
initStringInfo allocates only 256 bytes ,pg_beginmessage prepared 256 bytes 
of StringInfo for communication buffer.
 
It's hard to analyze pgsql source code,
because I'm a newbie, and have no idea about postgres 
internals,
But I will try hard!! 
 
Thank you.
Fri, 26 Jul 2002 03:43:30 +0900
"Kangmo, Kim" <ilvsusie@hahafos.com>
Two question about performance tuning issue.
On Fri, Jul 26, 2002 at 03:43:30AM +0900, Kangmo, Kim wrote:
> 2. appendStringInfoChar reallocates every bytes whenever needed,
> why don't reallocate chunk for better performace?

enlargeStringInfo() takes care of that -- from the comment in the
function:

    /*
     * We don't want to allocate just a little more space with each
     * append; for efficiency, double the buffer size each time it
     * overflows. Actually, we might need to more than double it if
     * 'needed' is big...
     */

Cheers,

Neil

-- 
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

Fri, 26 Jul 2002 10:20:28 -0400
nconway@klamath.dyndns.org (Neil Conway)
Re: Two question about performance tuning issue.