Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. --10M dataset
  2. with predictions as
  3. (
  4. select id ,probability
  5. from table
  6. )
  7.  
  8. -- give a rom_number to each record and then create 1000 groups
  9. , bin_groups as (
  10. select
  11. id,
  12. ceiling(1000.0*ROW_NUMBER() over(order by probability desc) / (select count(distinct id) from predictions)) as bins
  13. from predictions
  14. )
  15.  
  16. select *
  17. from bin_groups
  18. where bins = 1
  19. limit 100
  20.  
  21. Resources exceeded during query execution: The query could not be executed in the allotted memory. Peak usage: 102% of limit. Top memory consumer(s): JOIN operations: 96% other/unattributed: 4%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement