Performance optimizations

This commit is contained in:
Bernd Bestel
2020-12-20 10:44:19 +01:00
parent 76e4a1578c
commit b2d7003335
4 changed files with 28 additions and 12 deletions

View File

@@ -8,7 +8,10 @@ SELECT
p.name AS product_name,
plp.price * IFNULL(qucr.factor, 1.0) AS last_price_unit,
plp.price * IFNULL(qucr.factor, 1.0) * sl.amount AS last_price_total,
st.name AS default_shopping_location_name
st.name AS default_shopping_location_name,
qu.name AS qu_name,
qu.name_plural AS qu_name_plural,
pg.name AS product_group_name
FROM shopping_list sl
LEFT JOIN products p
ON sl.product_id = p.id
@@ -19,4 +22,8 @@ LEFT JOIN quantity_unit_conversions_resolved qucr
LEFT JOIN products_last_purchased plp
ON sl.product_id = plp.product_id
LEFT JOIN shopping_locations st
ON p.shopping_location_id = st.id;
ON p.shopping_location_id = st.id
LEFT JOIN quantity_units qu
ON sl.qu_id = qu.id
LEFT JOIN product_groups pg
ON p.product_group_id = pg.id;

View File

@@ -109,3 +109,13 @@ BEGIN
DELETE FROM battery_charge_cycles
WHERE battery_id = OLD.id;
END;
CREATE INDEX ix_chores_performance1 ON chores (
id,
active
);
CREATE INDEX ix_batteries_performance1 ON batteries (
id,
active
);