Cache expensive stock data calculations

This commit is contained in:
Bernd Bestel
2023-08-06 13:28:14 +02:00
parent 7689356a57
commit 1d7f7b2992
8 changed files with 527 additions and 32 deletions

View File

@@ -115,7 +115,6 @@ AS (
JOIN default_conversions s
ON c.path LIKE ('%/' || s.from_qu_id || '/' || s.to_qu_id || '/%') -- the conversion has been used as part of another path ...
WHERE NOT EXISTS(SELECT 1 FROM conversion_factors ci WHERE ci.product_id = c.product_id AND ci.from_qu_id = s.from_qu_id AND ci.to_qu_id = s.to_qu_id) -- ... and is itself new
)
SELECT DISTINCT
@@ -135,6 +134,5 @@ JOIN quantity_units qu_from
JOIN quantity_units qu_to
ON c.to_qu_id = qu_to.id
GROUP BY product_id, from_qu_id, to_qu_id
WINDOW win
AS (PARTITION BY product_id, from_qu_id, to_qu_id ORDER BY depth ASC)
ORDER BY product_id, from_qu_id, to_qu_id;
WINDOW win AS (PARTITION BY product_id, from_qu_id, to_qu_id ORDER BY depth ASC)
ORDER BY product_id, from_qu_id, to_qu_id;