Riddle me this, batman.
secretGeek .:dotnuts about dotnet:.
home .: about .: sign up .: sitemap .: secretGeek RSS

Riddle me this, batman.

Why do database designers deliberately create one-to-one relationships?

e.g. You can have a table with 50 columns, or you can have two tables with a one to one relationship, having 25 columns in one and 25 columns in the next (the foreign key acting as a primary key). Maybe the first column is called "Contact_Details" and the next table "Contact_Details_Extended"

What's the big advantage? Something tells me Frans Bouma might have an opinion on this. Anyone? Bueller? Bueller?




'ReallyVirtual' on Wed, 25 Aug 2004 20:36:02 GMT, writes:

Hi,

In the first post (blameMike's example), the first table contains the username/password only, which makes sense to me.

Consider a heavily used website running this database (maybe a webbased email with 1000 hits per second).

Users will probably log on thousands of times each year, but change their address once. For each password verification query, the database will need to scan db pages and pull up information. If we merge the two tables, the database will need to do a lot of extra work.
Deciding the clustered index/non-clustered indices for a database takes some thought if you are optimizing for performance, and usually results in scenarios like this.

Also, as you mentioned, if the database is in production/online, and you need to change its schema later, a partitioned approach like this will not lock tables unnecessarily.
There are other possible applications in replication scenarios as well.

I think you can probably find other good reasons on http://www.sqlserverperformance.com .

URL: http://www.reallyvirtual.com



'blameMike' on Sun, 02 May 2004 01:24:03 GMT, writes:

Holy unneccesary JOIN Batman

I just ran across something similar to this in a UML diagram one of my colleges sent me. It looks like this:

Table:
CustomerAccess

Fields:
CustomerID
UserName
Password

Table:
Customers

Fields:
CustomerID
FirstName
LastName
Address
City
State
Zip

To tell you the truth, I have no idea why he wanted to do this. In my opion there is no real advantage to this paradigm. In fact, I think this scheme will be slower if all this data needs to be returned due to the JOIN operation.

URL: http://www.blamemike.com



'rich...' on Wed, 28 Apr 2004 07:26:08 GMT, writes:

i'm with you on this one..dude..



'Mike Gunderloy' on Thu, 22 Apr 2004 11:38:46 GMT, writes:

Reasons I've seen this actually used:

1) Differential security
2) Getting by limits on number of columns in a table or number of bytes in a row. Extremely wide tables sometimes require this technique when you get down to the real database product.
3) Compatibility with other systems - ie, right now I'm involved with a project that is importing data from System X into System Y, and System Y needs extra columns. For other grotty infrastructure reasons we can only get full tables from X, not deltas, so it's simplest to keep our own data in extender tables.

URL: http://www.larkware.com



'Grant Queenin' on Thu, 22 Apr 2004 11:20:31 GMT, writes:

This is called vertical partitioning. It is used for a variety of reasons but performance is often cited. It is also of use where you have a canned application and need to extend it. Many commercial apps use this approach for user customisations.

Keeping volatile especially variable length fields away from more slowly changing or static fields. A positive sideeffect is that it slows the frag rate on the more slowly changing/static table and reduces maintenance burden. It also improves cache effectiveness as more data is packed into each read.

It can have some attractiveness for isolating columns which require more secure or different handling / treatment. Views are usually used for this.

Another reason to use this is to store archive/historical transactions (potential here for federated storage) in one instance of a table, and the current transactions
in a smaller table and these are unioned for queries with a view.

and the list of reasons goes on!

URL:



'Justin King' on Thu, 22 Apr 2004 04:36:50 GMT, writes:

My first instinct would be to say that indexing would be quicker, plus if you are only looking for queries to bring back part of data and not the Contact details extended would extract the data a little bit quicker.

But in this day and age with servers getting unbelievably fast, unless you are running 100TB databases then performance for mid size databases will not suffer as much.

All for good database design though!

URL: http://geekswithblogs.net/jking



'secretGeek' on Thu, 22 Apr 2004 04:31:02 GMT, writes:

(my own theory is that it saves on rebuilding a clustered index on the first table any time the extended table is altered [via Alter Table, I mean]. but i think there are other, better, reasons)

URL: http://www.secretgeek.net/one_to_why.asp



name

comment

(HTML not allowed)

homepage

All viewpoints welcome. But the right to delete any post for any reason is reserved. Don't make me do it. Comments may be republished, emailed to your loved ones or printed and used as toilet paper. Who reads this legal bit anyhow?

Back to Riddle me this, batman.

Articles

Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion
Got CSV in your javascript? Use agnes. Got CSV in your javascript? Use agnes.
I went to write down a book name and founded an internet empire instead. I went to write down a book name and founded an internet empire instead.
NimbleText: Origins NimbleText: Origins
The Windows 8 Mullet The Windows 8 Mullet
Cosby: spontaneous striped background generator Cosby: spontaneous striped background generator
Slides from WDCNZ: Live Coding Asp.net MVC3 Slides from WDCNZ: Live Coding Asp.net MVC3
MVC 3, MVC 3, "Third Times a Charm" references
Custom Errors in ASP.Net MVC: It couldn't be simpler, right? Custom Errors in ASP.Net MVC: It couldn't be simpler, right?
Anatomy of a Domain Hijacking, part 2: The Website Who Came In From The Cold Anatomy of a Domain Hijacking, part 2: The Website Who Came In From The Cold
Anatomy of a Domain Hijacking, part 1 Anatomy of a Domain Hijacking, part 1
secretGeek.net domain has been stolen. The site may go down. secretGeek.net domain has been stolen. The site may go down.
Boring article: 'untrusted domain' issue with SQL Server. Boring article: 'untrusted domain' issue with SQL Server.
Coding While You Commute Coding While You Commute
Test Driven Dentistry Is A Good Thing Test Driven Dentistry Is A Good Thing
The 'less crashy' release of NimbleText The 'less crashy' release of NimbleText
Rethinking Toolbars in Visual Studio (or any IDE) Rethinking Toolbars in Visual Studio (or any IDE)
Where shall we have lunch? Where shall we have lunch?
Setting up email for your microIsv Setting up email for your microIsv
The NO Visual Studio movement: Compiling .net projects in Notepad++ The NO Visual Studio movement: Compiling .net projects in Notepad++
ZeroOne: the editor for programmers who think in binary ZeroOne: the editor for programmers who think in binary
Mercurial workflow for personal projects (with a .net bias) Mercurial workflow for personal projects (with a .net bias)
I see you're using vim. Let me fix that for you. I see you're using vim. Let me fix that for you.
The worst recruitment spam I've ever read The worst recruitment spam I've ever read
A thank you I forgot to say A thank you I forgot to say
My new product, NimbleText, is live My new product, NimbleText, is live
Grabbing the free songs of Jonathan Coulton (with Powershell) Grabbing the free songs of Jonathan Coulton (with Powershell)
Using NimbleSet to compare lists Using NimbleSet to compare lists
Wanted: Wiki Lists (dot org) Wanted: Wiki Lists (dot org)
DOS on Dope: The last MVC web framework you'll ever need DOS on Dope: The last MVC web framework you'll ever need
JSON Query Languages: 5 special purpose editors JSON Query Languages: 5 special purpose editors
What then, is b? What then, is b?
SQLike: A simple editor SQLike: A simple editor
Yet Another BizPlan Generator. Yet Another BizPlan Generator.
HOT GUIDS: A hot or not site for guids HOT GUIDS: A hot or not site for guids
How does life get better? One tiny hack at a time. How does life get better? One tiny hack at a time.
24 things to do, and 100 things *not* to do (yet) for building a MicroISV 24 things to do, and 100 things *not* to do (yet) for building a MicroISV
Venture capital won't kill Jeff Atwood, it will only make him Jeffer. Venture capital won't kill Jeff Atwood, it will only make him Jeffer.
A handy workflow image for newbie mercurial users A handy workflow image for newbie mercurial users
Fractal Feedback, a diversion into recreational programming Fractal Feedback, a diversion into recreational programming
Hump-Jumping: How the Education of Computer Science can be Saved, err, maybe. Hump-Jumping: How the Education of Computer Science can be Saved, err, maybe.
Suggested User Experience Improvements for DiffMerge Suggested User Experience Improvements for DiffMerge
SQL Style Extensions for C# SQL Style Extensions for C#
The Movie Hollywood (And My Wife) Doesn't Want You To See: Weekend at Jacko's The Movie Hollywood (And My Wife) Doesn't Want You To See: Weekend at Jacko's
Sysi: the ultimate administrators toolkit Sysi: the ultimate administrators toolkit

Archives .: secretGeek :: Complete Archives
TimeSnapper -- Automated Screenshot Journal TimeSnapper.com    
Version 3.3: true productivity boost

Next Action NextAction
Managing the top of your mind

NimbleText -- World's Simplest Code GeneratorNimbleText -- World's Simplest Code Generator, Text Manipulator, Data Extractor

25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Universal Troubleshooting checklist Universal Troubleshooting Checklist
Top 10 SecretGeek articles Top 10 SecretGeek articles
ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Realtime CSS Editor, in a browser RealTime Online CSS Editor
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker


[powered by Google] 


How to be depressed How to be depressed
You are not inadequate.



Recommended Reading


the little schemer


The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Rhys Parry
Joel Pobar
Thomas White
OJ Reeves
Eric Sink

Aggregated Links

proggit
dzone
hacker news
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
weekly link post

LinkedIn profile
LogEnvy - event logs made sexy
Computer, Unlocked. A rapid computer customization resource
PC Smart Buys - Computer Hardware in Australia
 
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2003 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2003 .: privacy