Re: Netflix Prize data - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Netflix Prize data
Date
Msg-id 87hcyj64d2.fsf@enterprisedb.com
Whole thread Raw
In response to Re: Netflix Prize data  ("Greg Sabino Mullane" <greg@turnstep.com>)
Responses Re: Netflix Prize data  ("Mark Woodward" <pgsql@mohawksoft.com>)
List pgsql-hackers
"Greg Sabino Mullane" <greg@turnstep.com> writes:

> CREATE TABLE rating (
>   movie  SMALLINT NOT NULL,
>   person INTEGER  NOT NULL,
>   rating SMALLINT NOT NULL,
>   viewed DATE     NOT NULL
> );

You would probably be better off putting the two smallints first followed by
the integer and date. Otherwise both the integer and the date field will have
an extra two bytes of padding wasting 4 bytes of space.

If you reorder the fields that way you'll be down to 28 bytes of tuple header
overhead and 12 bytes of data. There's actually another 4 bytes in the form of
the line pointer so a total of 44 bytes per record. Ie, almost 73% of the disk
i/o you're seeing is actually per-record overhead.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: "Mark Woodward"
Date:
Subject: Re: Netflix Prize data
Next
From: Josh Berkus
Date:
Subject: Re: Updated version of FAQ_Solaris