> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Wednesday, January 22, 2003 4:04 PM
> To: Dann Corbit
> Cc: Steve Crawford; pgsql-performance@postgreSQL.org;
> pgsql-hackers@postgreSQL.org
> Subject: Re: [HACKERS] Terrible performance on wide selects
>
>
> "Dann Corbit" <DCorbit@connx.com> writes:
> > Maybe I don't really understand the problem, but it seems simple
> > enough to do it once for the whole query.
>
> We already do cache column offsets when they are fixed. The
> code that's the problem executes when there's a
> variable-width column in the table
> --- which means that all columns to its right are not at
> fixed offsets, and have to be scanned for separately in each
> tuple, AFAICS.
Why not waste a bit of memory and make the row buffer the maximum
possible length?
E.g. for varchar(2000) allocate 2000 characters + size element and point
to the start of that thing.
If we have 64K rows, even at that it is a pittance. If someone designs
10,000 row tables, then it will allocate an annoyingly large block of
memory, but bad designs are always going to cause a fuss.