File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
postgres/scripts/v2_to_v3 Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,50 @@ on conflict do nothing;
3939select count (* ) from results;
4040select sum (items_count) from mapping_sessions;
4141select count (* ) from mapping_sessions_results;
42+
43+
44+
45+
46+
47+ -- there are about 4.2 Million records for these project ids:
48+ -- -NBOh0mZWWn7zDn5i9Tq
49+ -- -NBOhCDaQSPYPMeVfA10
50+ -- -NE57yTnPUi_tR-Be8XB
51+ -- -NEaR6DbJAbkpYJ_BDCH
52+ -- -NEaU7GXxWRqKaFUYp_2
53+ -- -NFNqeu6lxjAAn2RGIow
54+ -- -NFNqqMf1_Cd5jjdAxcX
55+ -- -NFNr1ga2uSvgkHxWAu_
56+ -- -NFNr55R_LYJvxP7wmte
57+ -- -NFx1-XIxP8hdA_bVIYe
58+ -- -NH0GpIGfF2pu7V_sPnP
59+ select count (r.* )
60+ from mapping_sessions ms, results r
61+ where ms .start_time >= ' 2022-10-01'
62+ and ms .project_id = r .project_id
63+ and ms .group_id = r .group_id
64+ and ms .user_id = r .user_id ;
65+
66+ -- create table with results for projects with mapping since 2022-11-01
67+ drop table if exists results_since_2022_10_01;
68+ create table results_since_2022_10_01 as
69+ select r.*
70+ from mapping_sessions ms, results r
71+ where ms .start_time >= ' 2022-10-01'
72+ and ms .project_id = r .project_id
73+ and ms .group_id = r .group_id
74+ and ms .user_id = r .user_id ;
75+
76+ insert into mapping_sessions_results
77+ (
78+ select
79+ m .mapping_session_id
80+ ,r .task_id
81+ ,r." result"
82+ from results_since_2022_10_01 r, mapping_sessions m
83+ where
84+ r .project_id = m .project_id and
85+ r .group_id = m .group_id and
86+ r .user_id = m .user_id
87+ )
88+ on conflict do nothing;
You can’t perform that action at this time.
0 commit comments