Solved

Using "text tables" to store data - good or bad?

Posted on 2007-04-01
3
172 Views
Last Modified: 2010-03-19
As anyone who has looked into the inner workings of WordPress will have seen, they sometimes use text fields to store tabular data instead of creating an extra SQL table. An example of this is the "recently_edited" row in the "options" table.

For example: {a,b,c}{d,e,f} could be a three column, two row table.

My question: Is this a good or bad idea? Is there a name for this technique?

As far as I know any book on database design would always suggest moving this data into a separate table so that the information can be manipulated with an SQL query. However when you have a large database, it's often tempting to do this to cut down the number of tables and joins.

Thanks in advance for you input. Most useful response will get the points!
0
Comment
Question by:philwilks
3 Comments
 
LVL 27

Expert Comment

by:MikeToole
ID: 18831561
In SQL Server 2005 you can effectively do this with it's ability to store and query XML data
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 18832370
It's indeed a bad idea if this is data you use in your application/database and you use this method as a quick and dirty way of storing data which by nature is relational.

However, several engines offer the option to store an array in one field - InterSystems Caché and the new engine of Access in version 2007 - comes to my mind.
The reason to do this should be that the single elements of the array carry no useful information; the useful information is exactly the _collection_ of data elements.

An example could be RGB colour settings for, say, a background. Usually you create a compound value of the discrete values for R, G, and B respectively. This means that you have to perform a calculation both when storing and when retrieving a colour set to have the three values. Storing a three element array with the three values is much easier.
Of course, if you are able to store an array in an element of another array, this can be expanded, but I would say you should have very good reasons for doing so.

/gustav
0
 
LVL 22

Accepted Solution

by:
NovaDenizen earned 250 total points
ID: 18836196
I think it's ok if it's data you always use as a whole, it's limited in size, and you will never need to use the field in a WHERE clause.  
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
configure dependency in POM for new database 3 25
change database name 2 28
BACKUP of mysql database from mysql server - using Coldfusion 9 36
SYbase 4 29
This article describes some very basic things about SQL Server filegroups.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question