Ok this is noobish, but I am new to both databases and especially PostgreSQL.
I am planning out how I am going to setup my database schema, and I have quite a few fields in the different tables where I would like to set up an enum type similar to C and C++ style enum types. Essentially these fields will have like 5-15 choices, and the tables themselves might have on the order of 10 million rows. Now I know I can pretty easily simulate this with domain constraints.
However, I am a little concerned about performance in that case. If I use domain constraints and keep the choices as strings then a string comparison will be done whenver I query on this field right? I know an index will speed this up quite a bit but even so I may have to do 10s of thousands of string compares if there are only 5 choices right?
Ideally wouldn't it be better to store an integer field in the tables, and then keep a seperate small map table? Then the application could use the map table to look up the key and then do a query on the large table using only integer compares?
Am I just being silly or am I not understanding something here? Maybe there is another way to do this?
pgsql-novice by date
|Next:||From: Michael Glaesemann||Date: 2005-03-18 02:39:46|
|Subject: Re: Question on simulating Enum Data type|
|Previous:||From: Tom Lane||Date: 2005-03-17 23:33:43|
|Subject: Re: Multidimensional arrays in plpgsql |