liquid_feedback_core
changeset 327:ae0da58a9858
Correct index usage when calculating "harmonic_weight"
author | jbe |
---|---|
date | Sun Feb 10 19:14:29 2013 +0100 (2013-02-10) |
parents | d59d0c3e4a18 |
children | 16803f8dfcf0 |
files | core.sql |
line diff
1.1 --- a/core.sql Sun Feb 10 18:49:01 2013 +0100 1.2 +++ b/core.sql Sun Feb 10 19:14:29 2013 +0100 1.3 @@ -3047,9 +3047,9 @@ 1.4 1.5 1.6 1.7 -------------------------------------- 1.8 --- Calculation of harmonic weights -- 1.9 -------------------------------------- 1.10 +------------------------------------ 1.11 +-- Calculation of harmonic weight -- 1.12 +------------------------------------ 1.13 1.14 1.15 CREATE VIEW "remaining_harmonic_supporter_weight" AS 1.16 @@ -3063,17 +3063,17 @@ 1.17 JOIN "direct_interest_snapshot" 1.18 ON "issue"."id" = "direct_interest_snapshot"."issue_id" 1.19 AND "issue"."latest_snapshot_event" = "direct_interest_snapshot"."event" 1.20 + JOIN "initiative" 1.21 + ON "issue"."id" = "initiative"."issue_id" 1.22 + AND "initiative"."harmonic_weight" ISNULL 1.23 JOIN "direct_supporter_snapshot" 1.24 - ON "direct_interest_snapshot"."issue_id" = "direct_supporter_snapshot"."issue_id" 1.25 + ON "initiative"."id" = "direct_supporter_snapshot"."initiative_id" 1.26 AND "direct_interest_snapshot"."event" = "direct_supporter_snapshot"."event" 1.27 AND "direct_interest_snapshot"."member_id" = "direct_supporter_snapshot"."member_id" 1.28 - JOIN "initiative" 1.29 - ON "direct_supporter_snapshot"."initiative_id" = "initiative"."id" 1.30 AND ( 1.31 "direct_supporter_snapshot"."satisfied" = TRUE OR 1.32 coalesce("initiative"."admitted", FALSE) = FALSE 1.33 ) 1.34 - AND "initiative"."harmonic_weight" ISNULL 1.35 GROUP BY 1.36 "direct_interest_snapshot"."issue_id", 1.37 "direct_interest_snapshot"."event", 1.38 @@ -3091,17 +3091,17 @@ 1.39 sum("remaining_harmonic_supporter_weight"."weight_num") AS "weight_num", 1.40 "remaining_harmonic_supporter_weight"."weight_den" 1.41 FROM "remaining_harmonic_supporter_weight" 1.42 + JOIN "initiative" 1.43 + ON "remaining_harmonic_supporter_weight"."issue_id" = "initiative"."issue_id" 1.44 + AND "initiative"."harmonic_weight" ISNULL 1.45 JOIN "direct_supporter_snapshot" 1.46 - ON "remaining_harmonic_supporter_weight"."issue_id" = "direct_supporter_snapshot"."issue_id" 1.47 + ON "initiative"."id" = "direct_supporter_snapshot"."initiative_id" 1.48 AND "remaining_harmonic_supporter_weight"."event" = "direct_supporter_snapshot"."event" 1.49 AND "remaining_harmonic_supporter_weight"."member_id" = "direct_supporter_snapshot"."member_id" 1.50 - JOIN "initiative" 1.51 - ON "direct_supporter_snapshot"."initiative_id" = "initiative"."id" 1.52 AND ( 1.53 "direct_supporter_snapshot"."satisfied" = TRUE OR 1.54 coalesce("initiative"."admitted", FALSE) = FALSE 1.55 ) 1.56 - AND "initiative"."harmonic_weight" ISNULL 1.57 GROUP BY 1.58 "initiative"."issue_id", 1.59 "initiative"."id",