<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>t+1 - Latest Comments in Some research on generic/EAV tables</title><link>http://tplus1.disqus.com/</link><description></description><atom:link href="http://tplus1.disqus.com/some_research_on_genericeav_tables/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 09 Mar 2011 13:58:38 -0000</lastBuildDate><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-163095735</link><description>&lt;p&gt;&lt;br&gt;Very nice, I'm gonna try some of these, i don't know if they will work with me as i with to, but i'm gonna give this a try.&lt;br&gt; ... &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">meow mix coupons</dc:creator><pubDate>Wed, 09 Mar 2011 13:58:38 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-9068142</link><description>&lt;p&gt;"just denormalise all your data"&lt;/p&gt;

&lt;p&gt;Yeah, that seems to be the heart of big table, couch DB, and simple DB&lt;br&gt;are all about.  Saying "just denormalize" makes it seem like&lt;br&gt;converting a database from SQL to something like a gigantic&lt;br&gt;spreadsheet is no big deal.  But for a serious project, in order to&lt;br&gt;make sure that my stuff still works, I'd need to implement all sorts&lt;br&gt;of constraints and checks in my application layer.  By the time I&lt;br&gt;finish, I will probably have written a crappy subset of SQL.&lt;/p&gt;

&lt;p&gt;On the other hand, I think there are a lot of projects that can use a&lt;br&gt;simple denormalized database very well.  There's room in the ecosystem&lt;br&gt;for all sorts of different critters, but I don't think one can easily&lt;br&gt;be exchanged for another.&lt;/p&gt;

&lt;p&gt;I'll take a look at that PDF.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Wed, 06 May 2009 15:55:50 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-9067292</link><description>&lt;p&gt;Oops, also, 6NF joins are constant time (not linear) for constant number of rows, bad mistake. (for more on this, see page 29 on &lt;a href="http://www.anchormodeling.com/tiedostot/SU_KTH_Course_Presentation.pdf)" rel="nofollow"&gt;http://www.anchormodeling.com/...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm glad you enjoyed the post. I got interested in the EAV/relational debate after going to a Google Devfest where they explained AppEngine and BigTable. Now, AppEngine is cool, but I remember distinctly a point in the presentation where the explained BigTable and someone at the back asked a question "How do we do joins?". The guy from the Google team replied "Ah, well, ok, you need to rewrite your app so there are no joins - just denormalise all your data". &lt;/p&gt;

&lt;p&gt;There was an audible 5 second stony silence as people exchanged anxious glances, including from the Google team.&lt;/p&gt;

&lt;p&gt;From talking to people over the next few weeks, I realised that, at that moment, I'd guess about 30% of people in the room realised that the Emperor had no clothes (one guy actually walked out), the rest somehow managed to convince themselves that It's Google So It Must Be Good™.&lt;/p&gt;

&lt;p&gt;And I just think that's not right.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike A</dc:creator><pubDate>Wed, 06 May 2009 15:28:59 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-9055487</link><description>&lt;p&gt;Sorry, I meant to say: 'Migration is also much easier, as you can drop and add tables, without having to change code.' &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike A</dc:creator><pubDate>Wed, 06 May 2009 10:25:38 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-9055212</link><description>&lt;p&gt;Hi Mike,  You wrote a lot of interesting stuff.  I've never looked at 6NF but I'm going to now.  Am reading a book "SQL for Smarties" and the author spends a lot of time referring back to Codd's original work.&lt;/p&gt;

&lt;p&gt;Thanks for the post!  I'll maybe have some intelligent things to say after I do my homework.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Wed, 06 May 2009 10:15:51 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-9054786</link><description>&lt;p&gt;Seems to me that the problem is that SQL was never really 'relational'.&lt;/p&gt;

&lt;p&gt;The massive warts on the face of SQL is the NULLs. These things get everywhere and distort application logic into special casing them. Hack on top of ugly hack. We are forced to live with it as an accepted religion. Ever nullable column in a table represents a missing table, on average perhaps a hundred lines of hacky conditionals, weeks of programmer time already wasted, and months on maintenance issues ahead.&lt;/p&gt;

&lt;p&gt;See, what happened after SQL was that common programmers discovered the normal forms, but of course, these being wrapped in all that academic, mathematical nonsense, the masses never really got them, and so they settled on ideas like '3NF is good enough' and 'sometimes you have to denormalise'.&lt;/p&gt;

&lt;p&gt;The fact is, that even 5NF is not good enough for any serious application. The only decent policy, and one that data warehouses are starting to realise, is 6NF throughout (not DKNF). This gives you all of the flexibility benefits of EAV (adding an attribute means just adding a new table - none of your existing code needs to change), all of the benefits of 5NF and lower (real data integrity), and as added bonus, you never have to worry about NULLs (there are none), and you can historize your data (turning your database into revision system for free). Migration is also much easier, as you can d.&lt;/p&gt;

&lt;p&gt;As for JOIN performance, think about this - we know EAV sucks for performance as described above. Relational joins can also suck - but not if they are in 6NF. That's because, disregarding the number of rows, the time taken to join two tables, not to mention the sorting, filtering etc. is proportional to the number of attributes in the tables, which is a massive waste of time if you have 30 attributes in each table but only need 2 or 3 of them for the query, which is often the case. &lt;/p&gt;

&lt;p&gt;Because of this, developers and DBAs become disillusioned with their carefully 5NF databases, and hence they are vulnerable to EAV.&lt;/p&gt;

&lt;p&gt;6NF, on the other hand, does linear time joins, no matter how many attributes there are in the schema (as you only join what you need). That really matters when you have massive amounts of data, and is why such snake oil as EAV databases like BigTable are doomed. The advent of SSDs and cheap RAM will only make this more pertinent.&lt;/p&gt;

&lt;p&gt;If only people had actually listened to Codd.&lt;/p&gt;

&lt;p&gt;Check out anchor modelling for an example (although the naming scheme is a waste of time).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike A</dc:creator><pubDate>Wed, 06 May 2009 09:58:25 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-3226589</link><description>&lt;p&gt;True.&lt;br&gt;But this is also the downfall of databases.&lt;br&gt;How have you solved your initial problem? You still can not ask your original schema to tell you all about a person's preferences without knowing all the tables that exist beforehand. Which means everytime you come up with a new preference table, you have to add it to queries requiring to look at all preferences.&lt;br&gt;Databases do not seem to be good at managing information of this kind. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">GB</dc:creator><pubDate>Wed, 22 Oct 2008 10:03:19 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-3070357</link><description>&lt;p&gt;Hi Doug, thanks for the comment.  After I wrote this up I saw this pretty good EAV implementation here:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://permalink.gmane.org/gmane.comp.db.postgresql.general/114293" rel="nofollow"&gt;http://permalink.gmane.org/gma...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's flexible and it lets me use constraints to make sure nothing silly happens.  I bet it is probably slower performance-wise than the really inflexible approach of keeping every preference in a separate table, and I don't see how I could store information about the nature of the preferences, like which preference outranks another.&lt;/p&gt;

&lt;p&gt;I've had bad luck with relying on the UI to protect the integrity of the data.  A lot of times, I end up with numerous different interfaces; a command-line deal, some web app stuff, and so forth.&lt;/p&gt;

&lt;p&gt;I know it works for others, but I've been bitten more than once by not locking down my database against silly users.&lt;/p&gt;

&lt;p&gt;Anyhow, I've been trying to learn couchdb in my very scarce free time.  It's a completely different take on databases -- every object has its own set of attributes, but there's no guarantee that any two objects share anything.  Seems like the antithesis of the relational model.  So it probably makes a much better fit for some things.&lt;/p&gt;

&lt;p&gt;Completely unrelated -- you a programmer now too?  How much does the fact that you learned stuff like SAS influence how you program now?  Looking back on the Fed, I can't believe they would just scoop up complete novice programmers, and then just expect them to navigate and improve that code, and in general, it worked OK.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Wed, 15 Oct 2008 12:01:32 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-3052953</link><description>&lt;p&gt;I don't know, Matt, there's something to be said for Entity-Attribute-Value, if it's used judiciously.  Adding a new column to a table every time you want some sort of new behavior in your application is just not a sustainable way to program.  &lt;/p&gt;

&lt;p&gt;What I like to do is have first-class properties (i.e. database columns) on my model objects if a) I know every single object of this type will need this to be valued, or b) I am concerned about data integrity, or c) I plan to query this information frequently.  Then for other things that may not be defined for every instance of that type, and data integrity doesn't matter,   use attributes.  For example, in a standard CMS application, your Page object might have a column for "page_url" since every page needs to have a URL.  But I might use an attribute record for something like "main image caption", since not every page necessarily has an image, and if the caption is missing or just some random text I don't care.  Now when you add a second image to the page, and a second caption, you don't need to add a new column, you just add a new record.&lt;/p&gt;

&lt;p&gt;Tom's example seems completely ridiculous, because everybody has first name and last name and birthday...What he advocates is adding a "&amp;lt;couple fields="" flex="" for="" oddities="" of=""&amp;gt;"  So now you've got data in these extra fields, except you have a fixed number of them, and there's no context around what data is actually in those fields, which means you still can't query it easily, and you still can't enforce data integrity.  I prefer attributes to this mess.&lt;/p&gt;

&lt;p&gt;To address your problem of people putting in preferences for non-existent shifts, this sounds like a user-interface problem, not a database design problem.  If you are going to let them type in any old thing, then of course you can't have foreign keys, and will have to do application level validation.&lt;/p&gt;

&lt;p&gt;&amp;lt;/couple&amp;gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug R</dc:creator><pubDate>Tue, 14 Oct 2008 18:08:02 -0000</pubDate></item><item><title>Re: Some research on generic/EAV tables</title><link>http://blog.tplus1.com/index.php/2008/10/12/some-research-on-genericeav-tables/#comment-3018898</link><description>&lt;p&gt;Matt,&lt;/p&gt;

&lt;p&gt;Its good we have diverse databases to work with. The fact that RDBMS gives you the needed performance (except Join query) and no matter what Tom says, Just ask a developer what its like redesigning requirement change at later stage of developments.&lt;/p&gt;

&lt;p&gt;The EAV model is definitely much more flexible and gives the maximum freedom to the developers. And removes the join query as there are no two tables to join. &lt;/p&gt;

&lt;p&gt;I think you need to check &lt;a href="http://www.brainwavelive.com/developers/applications/poseidon-database.html" rel="nofollow"&gt;schemaless semantic database&lt;/a&gt; which is packed with &lt;a href="http://www.brainwavelive.com" rel="nofollow"&gt;Brainwave Platform&lt;/a&gt; a complete development and deployment suite mostly built in python.&lt;/p&gt;

&lt;p&gt;-Mac&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mac</dc:creator><pubDate>Mon, 13 Oct 2008 03:03:38 -0000</pubDate></item></channel></rss>
