Advertisement
tarkhil

solution

Aug 21st, 2020
1,622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BEGIN;
  2. select max(moment) from authors where interesting;
  3. -- Planning Time: 0.294 ms
  4. -- Execution Time: 0.655 ms
  5. create temporary table actual_users as select user_id from authors where moment > '2020-08-21 01:43:20.816825';
  6. -- SELECT 154265
  7. -- Planning Time: 0.189 ms
  8. -- Execution Time: 144.185 ms
  9. create temporary table actual_videos as select  id, author, loaded from videos where author in (select user_id from actual_users);
  10. -- SELECT 2395342
  11. -- Planning Time: 0.361 ms
  12. -- Execution Time: 238069.057 ms
  13. 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);
  14. -- UPDATE 7490
  15. -- Planning Time: 0.669 ms
  16. -- Execution Time: 3868.271 ms
  17. COMMIT;
  18. -- Всего около четырех минут
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement