Re: [GENERAL] Size comparison between a Composite type and an

2006-03-01 Thread denis
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

Re: [GENERAL] Size comparison between a Composite type and an

2006-03-01 Thread Tom Lane
[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

Re: [GENERAL] Size comparison between a Composite type and an

2006-03-01 Thread Martijn van Oosterhout
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

[GENERAL] Size comparison between a Composite type and an equivalent Text field

2006-02-28 Thread denis
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

Re: [GENERAL] Size comparison between a Composite type and an

2006-02-28 Thread Douglas McNaught
[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

Re: [GENERAL] Size comparison between a Composite type and an

2006-02-28 Thread Denis Gasparin
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

Re: [GENERAL] Size comparison between a Composite type and an

2006-02-28 Thread Douglas McNaught
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

Re: [GENERAL] Size comparison between a Composite type and an

2006-02-28 Thread Martijn van Oosterhout
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