Commit ee40c2cd authored by Nu Huyen Trang Pham's avatar Nu Huyen Trang Pham
Browse files

Update optimisation.sql

parent 8f19ffec
CREATE TABLE traitement_bis AS SELECT id_animal, medicament, quantite_medicaments_pj FROM traitement, traitement_medicament WHERE traitement.id_traitement = traitement_medicament.traitement ORDER BY traitement.id_animal, traitement_medicament.medicament;
CREATE INDEX ani ON traitement_bis(id_animal);
CREATE MATERIALIZED VIEW quantite_medicament_par_animal AS (SELECT medicament, SUM(quantite_medicaments_pj) FROM traitement_bis WHERE id_animal = $id_animal GROUP BY medicament);
CREATE MATERIALIZED VIEW quantite_medicament_total AS (SELECT medicament, SUM(quantite_medicaments_pj) FROM traitement_bis GROUP BY medicament);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment