<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-375697951860081841.post29975498318993336..comments</id><updated>2008-08-25T17:55:37.141+01:00</updated><category term='linux'/><category term='idea'/><category term='business'/><category term='Microsoft'/><category term='MySQL'/><category term='Programming Lanugage'/><category term='SQL'/><category term='ETL'/><category term='Email'/><category term='China'/><category term='pentaho'/><category term='informatica'/><category term='Jobs'/><category term='MS SQL'/><category term='open source'/><category term='federated tables'/><category term='Oracle'/><category term='data warehousing'/><category term='Google'/><category term='triggers'/><category term='decision tables'/><category term='PHP'/><category term='Views'/><category term='configuration-management'/><category term='event-driven publishing'/><category term='Data'/><category term='talend'/><category term='Agile'/><category term='business rules'/><category term='Decision tree'/><category term='ubuntu'/><category term='caching'/><category term='Data mining'/><category term='expert system'/><category term='database'/><category term='Excel'/><title type='text'>Comments on Jonathan Levin's Axioms: Storing Conditions in the Database</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.jonathanlevin.co.uk/feeds/29975498318993336/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default'/><link rel='alternate' type='text/html' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html'/><author><name>Jonathan</name><uri>http://www.blogger.com/profile/17336586681878234499</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/__8lgzcJRF8U/SOAxOE9FX9I/AAAAAAAAIf0/gzlxBGxU_gU/S220/mesmiling_cv.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-375697951860081841.post-4999672856347368873</id><published>2008-08-25T17:55:00.000+01:00</published><updated>2008-08-25T17:55:00.000+01:00</updated><title type='text'>Since even one complaint, regardless of the day, n...</title><content type='html'>Since even one complaint, regardless of the day, negates the bonus, you could probably just have a single complaint flag on the employee entry, which is set to true as soon as the first complaint of the month comes in. Then you only need to check against that rather than against each individual day.&lt;BR/&gt;&lt;BR/&gt;Similarly, you might implement counters for &amp;quot;Days over $300&amp;quot; and &amp;quot;Days late&amp;quot;. Instead of compiling them one by one and then summing them at the end, you just add one to the counter fields. Then your query for a bonus becomes a simple:&lt;BR/&gt;&lt;BR/&gt;SELECT * FROM employee&lt;BR/&gt;WHERE greater_than_avg &amp;gt;= 15&lt;BR/&gt;AND days_late &amp;lt; 5&lt;BR/&gt;AND complaints = 0&lt;BR/&gt;&lt;BR/&gt;This, of course, assumes that you don&amp;#39;t need the specific days that things happened for other record-keeping, but even if you do store them elsewhere, this touch of de-normalization can increase performance a bit (as long as you have a LOT of employees... otherwise the difference will probably be negligible).&lt;BR/&gt;&lt;BR/&gt;That said, I am inclined to agree with Roland that this is probably a bit more specific business logic than you want in the database.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/4999672856347368873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/4999672856347368873'/><link rel='alternate' type='text/html' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html?showComment=1219683300000#c4999672856347368873' title=''/><author><name>Joe Izenman</name><uri>http://www.sitecrafting.com</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html' ref='tag:blogger.com,1999:blog-375697951860081841.post-29975498318993336' source='http://www.blogger.com/feeds/375697951860081841/posts/default/29975498318993336' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-296076721'/></entry><entry><id>tag:blogger.com,1999:blog-375697951860081841.post-1555957813905539837</id><published>2008-08-25T17:52:00.000+01:00</published><updated>2008-08-25T17:52:00.000+01:00</updated><title type='text'>Hi, your solution looks a bit like a star schema. ...</title><content type='html'>Hi, your solution looks a bit like a star schema.  You should read about Dimensional Modeling (DM) which is a data-mining paradigm led by Ralph Kimball.  I haven't read enough about it but I think it may be applicable to this sort of problem.  &lt;BR/&gt;&lt;BR/&gt;See also:&lt;BR/&gt;"A Dimensional Modeling Manifesto"&lt;BR/&gt;http://www.dbmsmag.com/9708d15.html&lt;BR/&gt;&lt;BR/&gt;"The Data Warehouse Toolkit" by Ralph Kimball and Margy Ross&lt;BR/&gt;http://www.amazon.com/Data-Warehouse-Toolkit-Complete-Dimensional/dp/0471200247/</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/1555957813905539837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/1555957813905539837'/><link rel='alternate' type='text/html' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html?showComment=1219683120000#c1555957813905539837' title=''/><author><name>Bill Karwin</name><uri>http://www.blogger.com/profile/13004667086865377598</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.karwin.com/images/BK-portrait-260x360.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html' ref='tag:blogger.com,1999:blog-375697951860081841.post-29975498318993336' source='http://www.blogger.com/feeds/375697951860081841/posts/default/29975498318993336' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1913967369'/></entry><entry><id>tag:blogger.com,1999:blog-375697951860081841.post-7427829943413868036</id><published>2008-08-25T10:33:00.000+01:00</published><updated>2008-08-25T10:33:00.000+01:00</updated><title type='text'>Hey Roland&lt;br&gt;&lt;br&gt;Yes, there would be a cost anywa...</title><content type='html'>Hey Roland&lt;BR/&gt;&lt;BR/&gt;Yes, there would be a cost anyway to calculate it and I should have mentioned it in the post. My point was that it would be a one-time pre-paid cost.&lt;BR/&gt;* One-time meaning - if 3 different managers want to see the data (lets say sales, accounting and human resource), then you wouldn't need to process it again.&lt;BR/&gt;* Pre-paid meaning - you would process it before you would ask to see it, probably at the same time you inserted the data. If the time to insert then becomes unbearable, then this solution would be counter-productive.&lt;BR/&gt;&lt;BR/&gt;It very much depends on how you use the data. If you insert rarely and view often, then this would benefit you more.&lt;BR/&gt;&lt;BR/&gt;Regarding storing conditions, in my example I meant to use "sold more then average" which is more flexible. I will make the change now.&lt;BR/&gt;&lt;BR/&gt;As always Roland, I appreciate your feedback.&lt;BR/&gt;&lt;BR/&gt;Best Regards&lt;BR/&gt;Jonathan</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/7427829943413868036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/7427829943413868036'/><link rel='alternate' type='text/html' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html?showComment=1219656780000#c7427829943413868036' title=''/><author><name>Jonathan</name><uri>http://www.blogger.com/profile/17336586681878234499</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html' ref='tag:blogger.com,1999:blog-375697951860081841.post-29975498318993336' source='http://www.blogger.com/feeds/375697951860081841/posts/default/29975498318993336' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-878583402'/></entry><entry><id>tag:blogger.com,1999:blog-375697951860081841.post-5911320072752294709</id><published>2008-08-25T08:38:00.000+01:00</published><updated>2008-08-25T08:38:00.000+01:00</updated><title type='text'>Hi!&lt;br&gt;&lt;br&gt;"...Then whenever you want to see the r...</title><content type='html'>Hi!&lt;BR/&gt;&lt;BR/&gt;"...Then whenever you want to see the results of who will get bonus, you can query that table. This could save you that processing and waiting time we talked about earlier.&lt;BR/&gt;&lt;BR/&gt;Depending on how fast you would like your response to be when generating that list, you could use this method which does take up space but saves on processing time..."&lt;BR/&gt;&lt;BR/&gt;Well, wouldn't you have to take the cost of generating that list into account? So that at any rate, the consideration to put the conditions into the database would not save any costs, merely change the moment when the cost is suffered?&lt;BR/&gt;&lt;BR/&gt;Personally, I would only store conditions for business rules into the database if I would want the flexibility of changing the rules. And if I would do it, I would probably only store the raw constants that drive the logic, not the outcome. If you precalculate the outcome of the sub-rules ("earned 300$ or more", "less than 5 times late", "0 complaints") then you lose any hope of calculating the bonus in case the rules changed. For example, if you decide to change the rule "earned 300$ or more" to  "earned 350$ or more" then you will have to either update the flags for the last month, or settle for unjustly shelling out the bonus. If on the other hand you store the amount that must be earned ("300" and then "350") than any calculation: "earned ${bonus-earning} or more" will still work regardless of the actual value.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/5911320072752294709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/375697951860081841/29975498318993336/comments/default/5911320072752294709'/><link rel='alternate' type='text/html' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html?showComment=1219649880000#c5911320072752294709' title=''/><author><name>Roland Bouman</name><uri>http://www.blogger.com/profile/13365137747952711328</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.xcdsql.org/people/rbouman/roland.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.jonathanlevin.co.uk/2008/08/storing-conditions.html' ref='tag:blogger.com,1999:blog-375697951860081841.post-29975498318993336' source='http://www.blogger.com/feeds/375697951860081841/posts/default/29975498318993336' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1400074851'/></entry></feed>
