The wages of sinHit that database one more time…
Originally posted at 3/11/2011
This time, this is a review of the Sharp Commerce application. Again, I have stumbled upon the application by pure chance, and I have very little notion about who wrote it.
You might have wondered why I named this blog series the way I did, I named it because of the method outline below. Please note that I had to invent a new system to visualize the data access behavior on this system:
- In red, we have queries that are executed once: 3 queries total.
- In aqua, we have queries that are executed once for each item in the order: 2 queries per each product in the order.
- In purple, we have queries that are executed once for each attribute in each of the products in the order: 1 query per attribute per product in the order.
Now, just to give you some idea, let us say that I order 5 items, and each item have 5 attributes…
We get the following queries:
- 3 queries – basic method cost
- 10 queries – 2 queries per each product
- 25 queries – 1 query for each attribute for each product
Totaling in 38 queries for creating a fairly simple order. After seeing this during the course review of the application, I have used that term for this method, because it is almost too easy to make those sort of mistakes.
More posts in "The wages of sin" series:
- (24 Mar 2011) Hit that database one more time…
- (23 Mar 2011) Inverse leaky abstractions
- (22 Mar 2011) Proper and improper usage of abstracting an OR/M
- (21 Mar 2011) Re-creating the Stored Procedure API in C#
- (18 Mar 2011) Over architecture in the real world

Comments
Comment preview