I made some tests with three different types:
numeric, text and a specialized type written in c.
The tests were made with 20 digit codes.
The specialized type was a struct defined as:
typdef struct mycode {
char c1;
char c2;
int32 c3;
int32 c4;
} mycode
The sizeof(mycode) returns
[EMAIL PROTECTED] writes:
I made three tables of one column using the three different data types
and checked the size in bytes of the three tables.
The results were not as expected.
You forgot to consider per-row overhead, including alignment padding.
regards, tom
On Wed, Mar 01, 2006 at 05:24:03PM +0100, [EMAIL PROTECTED] wrote:
I made some tests with three different types:
numeric, text and a specialized type written in c.
The tests were made with 20 digit codes.
snip
The results were not as expected.
I was expecting these theoretical
I need to store very large integers (more of 30 digits).
I found two solutions to this problem:
- using a text field
- splitting the integer into 2 parts and then storing them in a
composite type with 2 bigint fields
The definitive choice will depend on the disk space used by one solution
[EMAIL PROTECTED] writes:
I need to store very large integers (more of 30 digits).
Er,
What's wrong with the NUMERIC type? That can go up to hundreds of
digits.
-Doug
---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will
Hi Doug.
I considered also the numeric type. In that case if the number is of 32
digits the storage size is of 2*8 + 8 = 24 bytes.
If i store it using a composite data type of two bigints the size is 2*8
+ composite data structure overhead bytes.
If the composite data type has 4 bytes
Denis Gasparin [EMAIL PROTECTED] writes:
If the composite data type has 4 bytes overhead, I save 4 bytes for
each number... that is important because I must store many many
numbers.
Yes, if size is a big issue you might be better off with a specialized
type.
-Doug
On Tue, Feb 28, 2006 at 09:51:54PM +0100, Denis Gasparin wrote:
Hi Doug.
I considered also the numeric type. In that case if the number is of 32
digits the storage size is of 2*8 + 8 = 24 bytes.
If i store it using a composite data type of two bigints the size is 2*8
+ composite data