Tag Info

New answers tagged

1

The composite type is clean design, but it does not help performance at all. First of all, float translates to float8 a.k.a. double precision in Postgres. You are building on a misunderstanding. The real data type occupies 4 byte (not 8). It has to be aligned at multiples of 4 bytes. Measure actual sizes with pg_column_size(). SQL Fiddle demonstrating ...


1

The parameter INTERNALLENGTH is only applicable to the creation of a new base type, which is a rather specialized operation for advanced users. It would require to provide input and output function etc. What you display is the creation of a new composite type, which is a more common operation. There is no parameter INTERNALLENGTH for that purpose. Read the ...


1

Use always the smallest data types that fits the values it will hold. 'Fit' is a flexible term, depending on thing like: Can it hold all current values of the table? Can it hold future values of the table? Is the data in a normal form? Can I create duplicate values? (think string vs. integer id that is a foreign key to an external table) Can I insert ...


1

Speaking from the programming side of the house, I would do a numerical value that is a foreign key to a "type" table. This way if you change the text value, all previous entries automatically update, and adding new types is just a matter of adding them into the table. This has the added benefit that if you do something like an interface with a dropdown ...


2

"The harmonized system uses a numbering" - they are not numbers, they are codes. They just happen to use digits instead of Latin letters for the code values. As you have to retain leading zeros anything numeric will not suit. You have to go with textual types. Suppose the codes were A01 LIVE ANIMALS A01B03 swine, live A01B03C10 Purebred ...



Top 50 recent answers are included