Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN;
- select max(moment) from authors where interesting;
- -- Planning Time: 0.294 ms
- -- Execution Time: 0.655 ms
- create temporary table actual_users as select user_id from authors where moment > '2020-08-21 01:43:20.816825';
- -- SELECT 154265
- -- Planning Time: 0.189 ms
- -- Execution Time: 144.185 ms
- create temporary table actual_videos as select id, author, loaded from videos where author in (select user_id from actual_users);
- -- SELECT 2395342
- -- Planning Time: 0.361 ms
- -- Execution Time: 238069.057 ms
- update authors set interesting = 't' where user_id in (select author from actual_videos where exists (select null from videos v where v.loaded is not null and v.author = author) group by author having count(*) > 50);
- -- UPDATE 7490
- -- Planning Time: 0.669 ms
- -- Execution Time: 3868.271 ms
- COMMIT;
- -- Всего около четырех минут
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement