![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Any comments on that appreciated. |
#3
| |||
| |||
|
|
Karsten Wutzke<kwutzke (AT) web (DOT) de> wrote: Any comments on that appreciated. Use a lookup-table instead. (FK-constraint) Andreas |
#4
| |||
| |||
|
|
Andreas Kretschmer, 07.04.2010 08:51: Karsten Wutzke<kwutzke (AT) web (DOT) de> wrote: Any comments on that appreciated. Use a lookup-table instead. (FK-constraint) Andreas I was about to answer the same, until I realized his languages table *is* the lookup table and he wants to limit the values in there. |
#5
| |||
| |||
|
|
Thomas Kellerer <OTPXDAJCS... (AT) spammotel (DOT) com> wrote: Andreas Kretschmer, 07.04.2010 08:51: Karsten Wutzke<kwut... (AT) web (DOT) de> *wrote: Any comments on that appreciated. Use a lookup-table instead. (FK-constraint) Andreas I was about to answer the same, until I realized his languages table *is* the lookup table and he wants to limit the values in there. That make no sense. Create a table with a CHECK-constraint and alter this constraint every time for a new record? Andreas |
#6
| |||
| |||
|
|
While they are CHAR(2), there are 26*26 = 676 combinations, of which not every one is valid. So, I might want to create a CHECK (cc IN ('AD', ..., 'ZW')) or so, with several hundred entries. Does it make sense to create such a big IN check? Is there a reasonable limit to the number of elements in the list? If so, how many? 7? 10? 14? 23? 62? 89? 200? |
#7
| |||
| |||
|
|
While they are CHAR(2), there are 26*26 = 676 combinations, of which not every one is valid. So, I might want to create a CHECK (cc IN ('AD', ..., 'ZW')) or so, with several hundred entries. Does it make sense to create such a big IN check? Is there a reasonable limit to the number of elements in the list? If so, how many? 7? 10? 14? 23? 62? 89? 200? |
#8
| |||
| |||
|
|
On 7 Apr., 18:46, Andreas Kretschmer <akretsch... (AT) spamfence (DOT) net wrote: Thomas Kellerer <OTPXDAJCS... (AT) spammotel (DOT) com> wrote: Andreas Kretschmer, 07.04.2010 08:51: Karsten Wutzke<kwut... (AT) web (DOT) de> Â*wrote: Any comments on that appreciated. Use a lookup-table instead. (FK-constraint) Andreas I was about to answer the same, until I realized his languages table *is* the lookup table and he wants to limit the values in there. That make no sense. Create a table with a CHECK-constraint and alter this constraint every time for a new record? Andreas Yes. I know it sounds contradictory at first, but if I don't use a lookup table, I have to adjust the CHECK for each new entry, too. Lookup tables are for situations where you want/need to *reuse* a check constraint, right? Using this kind of "double-check" clearly flags the table as a lookup table and not a regular one (even though the check is redundant). I mean, if it's still somewhat static, I do not change it often - if at all - anyway. It's truly another issue I'm very undecided about. But the question was rather: is there any limit on the IN check itself, I mean the list, if that makes sense? Example: country codes. http://www.iso.org/iso/iso-3166-1_decoding_table |
|
While they are CHAR(2), there are 26*26 = 676 combinations, of which not every one is valid. So, I might want to create a CHECK (cc IN ('AD', ..., 'ZW')) or so, with several hundred entries. Does it make sense to create such a big IN check? |
|
Is there a reasonable limit to the number of elements in the list? If so, how many? 7? 10? 14? 23? 62? 89? 200? |
#9
| |||
| |||
|
|
While they are CHAR(2), there are 26*26 = 676 combinations, of which not every one is valid. So, I might want to create a CHECK (cc IN ('AD', ..., 'ZW')) or so, with several hundred entries. Does it make sense to create such a big IN check? not when the rules will potentially change every few years. |
|
Is there a reasonable limit to the number of elements in the list? If so, how many? 7? 10? 14? 23? 62? 89? 200? somewhere Out past 10000 it could start getting more expensive than the foreign key check. *somewhere before that maintenance cost will get excessive. |
#10
| |||
| |||
|
|
While they are CHAR(2), there are 26*26 = 676 combinations, of which not every one is valid. So, I might want to create a CHECK (cc IN ('AD', ..., 'ZW')) or so, with several hundred entries. Does it make sense to create such a big IN check? not when the rules will potentially change every few years. Years? That sounds ok for me... |
|
Is there a reasonable limit to the number of elements in the list? If so, how many? 7? 10? 14? 23? 62? 89? 200? somewhere Out past 10000 it could start getting more expensive than the foreign key check. Â*somewhere before that maintenance cost will get excessive. So using a small list does not or only have marginal performance differences? |
|
Why is that so? Because the DBMS does the majority of integrity checks for the values on ALTER TABLE rather than on row inserts? |
![]() |
| Thread Tools | |
| Display Modes | |
| |