M --

Currently the storeconfigs tables dealing with facts look something
> like this (I've removed the columns that are irrelevant to the
> inventory service):
>
>        create_table :hosts do |t|
>          t.column :name, :string, :null => false
>        end
>
>        create_table :fact_names do |t|
>          t.column :name, :string, :null => false
>        end
>
>        create_table :fact_values do |t|
>          t.column :value, :text, :null => false
>          t.column :fact_name_id, :integer, :null => false
>          t.column :host_id, :integer, :null => false
>        end
>
> I propose something more like:
>
>        create_table :nodes do |t|
>          t.column :name, :string, :null => false
>          t.column :timestamp, :datetime
>        end
>
>        create_table :facts do |t|
>          t.column :name, :string, :null => false
>          t.column :value, :text, :null => false
>          t.column :node_id, :integer, :null => false
>        end
>
> It's less normalized than the storeconfigs schema since fact names
> will be duplicated per node, but easier to understand and work with,
> and I think better satisfies the types of queries we will be doing
> which are of the form "select nodes where fact equal to value".  The
> more normalized schema would be better for queries of the form "select
> all values for fact", but I don't think that's something we'll be
> doing.  Correct me if I'm wrong.
>

I'm not saying that you're wrong, but I'm not seeing how the denormalized
table would be easier to work with; and if anything I would expect that it
would be slower to query (and slower to update) in the denormalized form.
If you index on [fact_id,value] the query should be blazingly fast, and this
would be easier/cheaper to maintain than a key on [name,value]...or am I
missing something?



> Other benefits of the proposed schema include the "metadata" about
> each fact set being columns on the node table (Nick has also proposed
> that table be called fact_sets and have a column called node_name)
> instead of being stored as a fact.


So completely denormalized?  Why?

-- M
-----------------------------------------------------------
When in trouble or in doubt, run in circles,
scream and shout. -- 1920's parody of the
maritime general prudential rule
------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to