Re: 1 char in the world - Mailing list pgsql-performance

From Matt Mello
Subject Re: 1 char in the world
Date
Msg-id 3E3863F6.2020004@spaceship.com
Whole thread Raw
In response to Re: 1 char in the world  (Hannu Krosing <hannu@tm.ee>)
Responses Re: 1 char in the world  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
> OTOH the actual storage of one-char datatype should not play so
> significant role for very large tables, even if this is the only field
> in that table, as most of the overhead will be in other places - storage
> overhead in page/tuple headers, performance in retrieving the
> pages/tuples and cache lookups, etc.

Is that true if I have a table that consists of lots of 1-char fields?
For example, if I have a table with 4 billion records, which consist of
(20) 1-char fields each, then the storage for the data will be something
like 5 times as large if I use TEXT than if I use "char".

> Also, for very big tables you will most likely want to restrict selects
> on other criteria than a 4-valued field, so that indexes could be used
> in retrieving data.

I do.  I was just using that query for this test only.  I have some very
complex queries that are constrained by many foriegn-key int4 fields,
but also a few of these 1-char fields.

> You could also try just
>
> select count(*) from table where bool;
>

I will do this in a while and report to the list.  I am going to try
make a reproducable test that anyone can do, to be sure my results are
"real".

> Did you repeat the texts enough times to be sure that you get reliable
> results ?

I think so.  Not so much as hundreds of times, though.


--
Matt Mello
512-350-6900


pgsql-performance by date:

Previous
From: John Lange
Date:
Subject: Re: Query plan and Inheritance. Weird behavior
Next
From: Tom Lane
Date:
Subject: Re: 1 char in the world