The wages of sin: Hit that database one more time…
Join the DZone community and get the full member experience.Join For Free
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.
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Extending Java APIs: Add Missing Features Without the Hassle
Auditing Tools for Kubernetes
Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers
Design Patterns for Microservices: Ambassador, Anti-Corruption Layer, and Backends for Frontends