Re: fixed-length row - Mailing list pgsql-general

From Tom Lane
Subject Re: fixed-length row
Date
Msg-id 22409.1074182095@sss.pgh.pa.us
Whole thread Raw
In response to fixed-length row  (David Garamond <lists@zara.6.isreserved.com>)
List pgsql-general
David Garamond <lists@zara.6.isreserved.com> writes:
> The MySQL manual recommends that we create a "fixed-length row" if
> possible, for speed (especially scanning speed).

> Is there a similar recommendation in PostgreSQL?

No.  There are some marginal optimizations that take place if your
columns are fixed-width and not null, but I wouldn't suggest contorting
your database design to enable them to occur.

In particular, people who have taken this bait generally think that
it's a good idea to substitute char(n) for varchar(n).  That is almost
inevitably a pessimization, because the extra I/O time for all those
padding blanks will surely swamp the few CPU cycles saved by using
precalculated field offsets.  (Not to mention that char(n) is not really
fixed-width anyway, in Postgres or any other implementation that
supports variable-length character encodings.)

I'd be willing to speculate that the MySQL manual's advice is bad
even for MySQL, but I haven't benchmarked the case there.

            regards, tom lane

pgsql-general by date:

Previous
From: Karsten Hilbert
Date:
Subject: Re: Using regular expressions in LIKE
Next
From: Stephan Szabo
Date:
Subject: Re: Returning large select results from stored procedures