mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 05:16:15 +02:00
Restore performance indexes from #927
This commit is contained in:
parent
94878d57ae
commit
04f4f906b0
|
|
@ -1,3 +1,33 @@
|
||||||
|
CREATE INDEX ix_products_performance1 ON products (
|
||||||
|
parent_product_id
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX ix_products_performance2 ON products (
|
||||||
|
CASE WHEN parent_product_id IS NULL THEN id ELSE parent_product_id END,
|
||||||
|
active
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX ix_stock_performance1 ON stock (
|
||||||
|
product_id,
|
||||||
|
open,
|
||||||
|
best_before_date,
|
||||||
|
amount
|
||||||
|
);
|
||||||
|
|
||||||
|
DROP VIEW products_resolved;
|
||||||
|
CREATE VIEW products_resolved
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
CASE
|
||||||
|
WHEN p.parent_product_id IS NULL THEN
|
||||||
|
p.id
|
||||||
|
ELSE
|
||||||
|
p.parent_product_id
|
||||||
|
END AS parent_product_id,
|
||||||
|
p.id as sub_product_id
|
||||||
|
FROM products p
|
||||||
|
WHERE p.active = 1;
|
||||||
|
|
||||||
DROP VIEW stock_missing_products_including_opened;
|
DROP VIEW stock_missing_products_including_opened;
|
||||||
CREATE VIEW stock_missing_products_including_opened
|
CREATE VIEW stock_missing_products_including_opened
|
||||||
AS
|
AS
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user