Created
May 15, 2012 18:21
-
-
Save souen/2703937 to your computer and use it in GitHub Desktop.
Slow queries sur les section sans contenus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requête 1: sélectionne un contentmodel lié à la rubrique *100126* (qui n'en contient aucun) | |
# Prend 15-30s | |
SELECT "libe_contentmodel"."id","libe_contentmodel"."child_type" | |
FROM "libe_contentmodel" | |
INNER JOIN "libe_contenttosection" | |
ON ("libe_contentmodel"."id" = "libe_contenttosection"."content_model_id") | |
WHERE ("libe_contenttosection"."section_id" = 100126 AND "libe_contentmodel"."workflow_state" = 20 ) | |
ORDER BY "libe_contentmodel"."computed_ponderation" DESC, "libe_contentmodel"."updating_date" DESC LIMIT 1 | |
# Requête 2: remonte un contentmodel lié à la rubrique *100132* (qui en contient un) | |
# Est rapide! | |
SELECT "libe_contentmodel"."id", "libe_contentmodel"."child_type" | |
FROM "libe_contentmodel" | |
INNER JOIN "libe_contenttosection" | |
ON ("libe_contentmodel"."id" = "libe_contenttosection"."content_model_id") | |
WHERE ("libe_contenttosection"."section_id" = 100132 AND "libe_contentmodel"."workflow_state" = 20 ) | |
ORDER BY "libe_contentmodel"."computed_ponderation" DESC, "libe_contentmodel"."updating_date" DESC LIMIT 1 | |
# Why ?? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment