dbTalk Databases Forums  

Suggestions for refactoring unusual tables

comp.databases comp.databases


Discuss Suggestions for refactoring unusual tables in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 09-24-2008 , 06:12 PM






Conrad Lender <crlender (AT) yahoo (DOT) com> wrote:

Quote:
On 2008-09-24 06:08, --CELKO-- wrote:
No need to throw a perfectly good design out because of
programmer incompetence. Better throw the programmer away :-)

Throw away the idiot who did the EAV.

Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database
It is a mistake that people keep making. We see postings about
it here over and over and over.

Did you know that Russian Roulette has an over 80% success rate?

Would you like to play?

I advise against it and EAV.

Quote:
designer) is me, and see no reason to throw myself away or consider
myself incompetent for having to work with a certain kind of data model.
I saw what I thought was a dubious design choice, and asked for
opinions, that's all. The rest of the schema is designed very well.
And you got them, didn't you?

When you know, EAV is not dubious (doubtful). It is just plain
bad.

Quote:
We're not going to throw anybody away.
[snip]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
  #22  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 09-24-2008 , 06:12 PM






Conrad Lender <crlender (AT) yahoo (DOT) com> wrote:

Quote:
On 2008-09-24 06:08, --CELKO-- wrote:
No need to throw a perfectly good design out because of
programmer incompetence. Better throw the programmer away :-)

Throw away the idiot who did the EAV.

Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database
It is a mistake that people keep making. We see postings about
it here over and over and over.

Did you know that Russian Roulette has an over 80% success rate?

Would you like to play?

I advise against it and EAV.

Quote:
designer) is me, and see no reason to throw myself away or consider
myself incompetent for having to work with a certain kind of data model.
I saw what I thought was a dubious design choice, and asked for
opinions, that's all. The rest of the schema is designed very well.
And you got them, didn't you?

When you know, EAV is not dubious (doubtful). It is just plain
bad.

Quote:
We're not going to throw anybody away.
[snip]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
  #23  
Old   
Conrad Lender
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 10-07-2008 , 12:20 AM



On 2008-09-25 01:12, Gene Wirchenko wrote:
Quote:
Conrad Lender <crlender (AT) yahoo (DOT) com> wrote:
On 2008-09-24 06:08, --CELKO-- wrote:
Throw away the idiot who did the EAV.
Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database

It is a mistake that people keep making. We see postings about
it here over and over and over.

Did you know that Russian Roulette has an over 80% success rate?

Would you like to play?

I advise against it and EAV.
[...]
When you know, EAV is not dubious (doubtful). It is just plain
bad.
I can see that a number of people have had bad experiences with EAV
designs, and are vehemently opposed to the whole idea; I understand the
reasons for this. However, I'm still not convinced that our two
"catalog" tables can really be described as EAV.

There was an implicit conclusion that the tables should be refactored,
but no suggestions about how go about it. Allow me to rephrase my question:

1) When you have 63 groups of relatively static categorization options
like I have described (all with the same fields, but belonging to
semantically different categories), would it *really* be advisable to
break that larger table up into 63 separate very small tables with the
same column layout?

2) With the added constraint checks from my previous post, is there any
way that the data/references could possibly become inconsistent?

3) How would you design a database where many of the entities can have
distinct "types" in one or more fields (eg. a "status" field could have
the values "old", "active", "in_review"), and these types need to have
editable textual descriptions? Do you create small
{entityname}_{typename} tables for each of those fields, each containing
only a few rows?


- Conrad


Reply With Quote
  #24  
Old   
Conrad Lender
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 10-07-2008 , 12:20 AM



On 2008-09-25 01:12, Gene Wirchenko wrote:
Quote:
Conrad Lender <crlender (AT) yahoo (DOT) com> wrote:
On 2008-09-24 06:08, --CELKO-- wrote:
Throw away the idiot who did the EAV.
Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database

It is a mistake that people keep making. We see postings about
it here over and over and over.

Did you know that Russian Roulette has an over 80% success rate?

Would you like to play?

I advise against it and EAV.
[...]
When you know, EAV is not dubious (doubtful). It is just plain
bad.
I can see that a number of people have had bad experiences with EAV
designs, and are vehemently opposed to the whole idea; I understand the
reasons for this. However, I'm still not convinced that our two
"catalog" tables can really be described as EAV.

There was an implicit conclusion that the tables should be refactored,
but no suggestions about how go about it. Allow me to rephrase my question:

1) When you have 63 groups of relatively static categorization options
like I have described (all with the same fields, but belonging to
semantically different categories), would it *really* be advisable to
break that larger table up into 63 separate very small tables with the
same column layout?

2) With the added constraint checks from my previous post, is there any
way that the data/references could possibly become inconsistent?

3) How would you design a database where many of the entities can have
distinct "types" in one or more fields (eg. a "status" field could have
the values "old", "active", "in_review"), and these types need to have
editable textual descriptions? Do you create small
{entityname}_{typename} tables for each of those fields, each containing
only a few rows?


- Conrad


Reply With Quote
  #25  
Old   
Conrad Lender
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 10-07-2008 , 12:20 AM



On 2008-09-25 01:12, Gene Wirchenko wrote:
Quote:
Conrad Lender <crlender (AT) yahoo (DOT) com> wrote:
On 2008-09-24 06:08, --CELKO-- wrote:
Throw away the idiot who did the EAV.
Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database

It is a mistake that people keep making. We see postings about
it here over and over and over.

Did you know that Russian Roulette has an over 80% success rate?

Would you like to play?

I advise against it and EAV.
[...]
When you know, EAV is not dubious (doubtful). It is just plain
bad.
I can see that a number of people have had bad experiences with EAV
designs, and are vehemently opposed to the whole idea; I understand the
reasons for this. However, I'm still not convinced that our two
"catalog" tables can really be described as EAV.

There was an implicit conclusion that the tables should be refactored,
but no suggestions about how go about it. Allow me to rephrase my question:

1) When you have 63 groups of relatively static categorization options
like I have described (all with the same fields, but belonging to
semantically different categories), would it *really* be advisable to
break that larger table up into 63 separate very small tables with the
same column layout?

2) With the added constraint checks from my previous post, is there any
way that the data/references could possibly become inconsistent?

3) How would you design a database where many of the entities can have
distinct "types" in one or more fields (eg. a "status" field could have
the values "old", "active", "in_review"), and these types need to have
editable textual descriptions? Do you create small
{entityname}_{typename} tables for each of those fields, each containing
only a few rows?


- Conrad


Reply With Quote
  #26  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 10-07-2008 , 10:59 AM



On Oct 7, 12:20*am, Conrad Lender <crlen... (AT) yahoo (DOT) com> wrote:
Quote:
On 2008-09-25 01:12, Gene Wirchenko wrote:



Conrad Lender <crlen... (AT) yahoo (DOT) com> wrote:
On 2008-09-24 06:08, --CELKO-- wrote:
Throw away the idiot who did the EAV.
Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database

* * *It is a mistake that people keep making. *We see postings about
it here over and over and over.

* * *Did you know that Russian Roulette has an over 80% success rate?

* * *Would you like to play?

* * *I advise against it and EAV.
[...]
* * *When you know, EAV is not dubious (doubtful). *It is just plain
bad.

I can see that a number of people have had bad experiences with EAV
designs, and are vehemently opposed to the whole idea; I understand the
reasons for this. However, I'm still not convinced that our two
"catalog" tables can really be described as EAV.

There was an implicit conclusion that the tables should be refactored,
but no suggestions about how go about it. Allow me to rephrase my question:

1) When you have 63 groups of relatively static categorization options
like I have described (all with the same fields, but belonging to
semantically different categories), would it *really* be advisable to
break that larger table up into 63 separate very small tables with the
same column layout?
Yes. What's wrong with several small tables? You may actually save a
little space (the "type" column likely becomes the new table name so
it is not repeated).

Quote:
2) With the added constraint checks from my previous post, is there any
way that the data/references could possibly become inconsistent?
I do not know, but I think it must be possible to get it inconsistent.
Just set a new programmer up to add some new values.
Quote:
3) How would you design a database where many of the entities can have
distinct "types" in one or more fields (eg. a "status" field could have
the values "old", "active", "in_review"), and these types need to have
editable textual descriptions? Do you create small
{entityname}_{typename} tables for each of those fields, each containing
only a few rows?
I have used a Descriptions table, but only in applications which had
to be multilingual. If you never configure a translation of your
application, why split the description out?
Do you really want to let users (even power users who should "know
what they are doing") change value descriptions?
Quote:
* - Conrad
I am currently working on a system that has a design similar to yours.
When programming I have to either:
hard code the ID values (very bad style and brittle code, ie, easy to
break)
hard code the descriptions and query for the IDs (less brittle, more
human friendly)

Because of the nested relationships among the codes in my system, I
could not write simple SQL statements to insert a new service. It
required writing a procedure to handle the relationships.

It would be a lot easier to understand and program for a system which
has Status codes in a status table and Service types in a Service
table and so on. Even if those tables have only a few rows. It
actually would make it a lot easier to expand the options.

So I would argue less from the Relational theory view and more from a
practical, how-the-hell-do-I-maintain- this-beast, view.

Take the chance while you have it and split those tables out. You will
be much happier later.


Reply With Quote
  #27  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 10-07-2008 , 10:59 AM



On Oct 7, 12:20*am, Conrad Lender <crlen... (AT) yahoo (DOT) com> wrote:
Quote:
On 2008-09-25 01:12, Gene Wirchenko wrote:



Conrad Lender <crlen... (AT) yahoo (DOT) com> wrote:
On 2008-09-24 06:08, --CELKO-- wrote:
Throw away the idiot who did the EAV.
Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database

* * *It is a mistake that people keep making. *We see postings about
it here over and over and over.

* * *Did you know that Russian Roulette has an over 80% success rate?

* * *Would you like to play?

* * *I advise against it and EAV.
[...]
* * *When you know, EAV is not dubious (doubtful). *It is just plain
bad.

I can see that a number of people have had bad experiences with EAV
designs, and are vehemently opposed to the whole idea; I understand the
reasons for this. However, I'm still not convinced that our two
"catalog" tables can really be described as EAV.

There was an implicit conclusion that the tables should be refactored,
but no suggestions about how go about it. Allow me to rephrase my question:

1) When you have 63 groups of relatively static categorization options
like I have described (all with the same fields, but belonging to
semantically different categories), would it *really* be advisable to
break that larger table up into 63 separate very small tables with the
same column layout?
Yes. What's wrong with several small tables? You may actually save a
little space (the "type" column likely becomes the new table name so
it is not repeated).

Quote:
2) With the added constraint checks from my previous post, is there any
way that the data/references could possibly become inconsistent?
I do not know, but I think it must be possible to get it inconsistent.
Just set a new programmer up to add some new values.
Quote:
3) How would you design a database where many of the entities can have
distinct "types" in one or more fields (eg. a "status" field could have
the values "old", "active", "in_review"), and these types need to have
editable textual descriptions? Do you create small
{entityname}_{typename} tables for each of those fields, each containing
only a few rows?
I have used a Descriptions table, but only in applications which had
to be multilingual. If you never configure a translation of your
application, why split the description out?
Do you really want to let users (even power users who should "know
what they are doing") change value descriptions?
Quote:
* - Conrad
I am currently working on a system that has a design similar to yours.
When programming I have to either:
hard code the ID values (very bad style and brittle code, ie, easy to
break)
hard code the descriptions and query for the IDs (less brittle, more
human friendly)

Because of the nested relationships among the codes in my system, I
could not write simple SQL statements to insert a new service. It
required writing a procedure to handle the relationships.

It would be a lot easier to understand and program for a system which
has Status codes in a status table and Service types in a Service
table and so on. Even if those tables have only a few rows. It
actually would make it a lot easier to expand the options.

So I would argue less from the Relational theory view and more from a
practical, how-the-hell-do-I-maintain- this-beast, view.

Take the chance while you have it and split those tables out. You will
be much happier later.


Reply With Quote
  #28  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Suggestions for refactoring unusual tables - 10-07-2008 , 10:59 AM



On Oct 7, 12:20*am, Conrad Lender <crlen... (AT) yahoo (DOT) com> wrote:
Quote:
On 2008-09-25 01:12, Gene Wirchenko wrote:



Conrad Lender <crlen... (AT) yahoo (DOT) com> wrote:
On 2008-09-24 06:08, --CELKO-- wrote:
Throw away the idiot who did the EAV.
Thank you both for your replies, although I'm a little surprised at the
heated comments. The programmer in this project (not the database

* * *It is a mistake that people keep making. *We see postings about
it here over and over and over.

* * *Did you know that Russian Roulette has an over 80% success rate?

* * *Would you like to play?

* * *I advise against it and EAV.
[...]
* * *When you know, EAV is not dubious (doubtful). *It is just plain
bad.

I can see that a number of people have had bad experiences with EAV
designs, and are vehemently opposed to the whole idea; I understand the
reasons for this. However, I'm still not convinced that our two
"catalog" tables can really be described as EAV.

There was an implicit conclusion that the tables should be refactored,
but no suggestions about how go about it. Allow me to rephrase my question:

1) When you have 63 groups of relatively static categorization options
like I have described (all with the same fields, but belonging to
semantically different categories), would it *really* be advisable to
break that larger table up into 63 separate very small tables with the
same column layout?
Yes. What's wrong with several small tables? You may actually save a
little space (the "type" column likely becomes the new table name so
it is not repeated).

Quote:
2) With the added constraint checks from my previous post, is there any
way that the data/references could possibly become inconsistent?
I do not know, but I think it must be possible to get it inconsistent.
Just set a new programmer up to add some new values.
Quote:
3) How would you design a database where many of the entities can have
distinct "types" in one or more fields (eg. a "status" field could have
the values "old", "active", "in_review"), and these types need to have
editable textual descriptions? Do you create small
{entityname}_{typename} tables for each of those fields, each containing
only a few rows?
I have used a Descriptions table, but only in applications which had
to be multilingual. If you never configure a translation of your
application, why split the description out?
Do you really want to let users (even power users who should "know
what they are doing") change value descriptions?
Quote:
* - Conrad
I am currently working on a system that has a design similar to yours.
When programming I have to either:
hard code the ID values (very bad style and brittle code, ie, easy to
break)
hard code the descriptions and query for the IDs (less brittle, more
human friendly)

Because of the nested relationships among the codes in my system, I
could not write simple SQL statements to insert a new service. It
required writing a procedure to handle the relationships.

It would be a lot easier to understand and program for a system which
has Status codes in a status table and Service types in a Service
table and so on. Even if those tables have only a few rows. It
actually would make it a lot easier to expand the options.

So I would argue less from the Relational theory view and more from a
practical, how-the-hell-do-I-maintain- this-beast, view.

Take the chance while you have it and split those tables out. You will
be much happier later.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.