daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Jul 17th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. drop table if exists s_multi_update_same_row;
  2.  
  3. create table s_multi_update_same_row(
  4.     id int,
  5.     count int
  6. );
  7.  
  8. insert into s_multi_update_same_row select id, 0 from generate_series(1, 1000) as id;
  9.  
  10. update s_multi_update_same_row A set count = count + 1 from generate_series(1, 10000) as B(id) where A.id = B.id % 1000 + 1;
  11.  
  12. select id, count from s_multi_update_same_row limit 10;
RAW Paste Data
Top