Summary:
StockLevel uses a join across OrderLine and Stock tables to get the
stock of the items present in the last 20 transactions. Performing an
explain on the query showed that we use a NestedLoop across the 2 tables
with the query on the Stock table being a point lookup.
Avoid this expensive reads using the select in syntax.
The average latency of the transaction reduces by 40%.
Old Change: Avg Latency: 87.026 msecs, p99 Latency: 463.411 msecs
New Change: Avg Latency: 49.694 msecs, p99 Latency: 570.755 msecs
Summary: StockLevel uses a join across OrderLine and Stock tables to get the stock of the items present in the last 20 transactions. Performing an explain on the query showed that we use a NestedLoop across the 2 tables with the query on the Stock table being a point lookup.
Avoid this expensive reads using the
select in
syntax.The average latency of the transaction reduces by 40%. Old Change: Avg Latency: 87.026 msecs, p99 Latency: 463.411 msecs New Change: Avg Latency: 49.694 msecs, p99 Latency: 570.755 msecs
Reviewers: Mihnea