When to use composite types and arrays and when to normalize a database?

Are there any recommendations for normalizing the database or just using composite types and arrays?

When using arrays and composite types, I can only use one table. I can also normalize the database and use a couple of tables and joins.

How do you decide which option is best?

+3
source share
1 answer

. , . , "" , , // . , . ( SELECT ... FOR UPDATE , ).

// , PostgreSQL , MVCC. ( TOAST , , ). , .

, , , .

IIRC , , , . Ditto arrays ( , , , - ).

(PgJDBC, psqlODBC, psycopg2 .. .. ..) , . , , .

ORM, , Hibernate, -, SQL . - , . OTOH, ORM , , - , hstore EAV , jstore ( , 9.4, json hstore).

(, , , "-" , , ).

, , , . ON INSERT OR UPDATE OR DELETE ... DO INSTEAD . .

, - "". , , . (, , " " , , SQL-), , (timestamp without time zone, tzname), .

, , . , - , . , , , "" , , .

+7

All Articles