Results 1 to 2 of 2

Thread: Bucket Size

  1. #1
    Join Date
    Aug 2003

    Unanswered: Bucket Size

    Hi Alan,

    Can u please elaborate more or can u give me a sample
    code for your reply on updating of million records which
    uses that bucket size.


  2. #2
    Join Date
    Mar 2002
    Reading, UK
    It depends on your data but what you need to do is to pick a column which has roughly even data distribution. If it has then divde the max-min by the number of buckets you require so if you have a million records and say you want to process roughly 10000 records at a time then in psuedo code

    select max(x), min(x) into max_x, min_x from table;
    bucketsize:= (max_x-min_x)/(1000000/10000)
    for i = min_x to max_x step bucketsize
    select ... from table where x between i and i+(bucketsize-1)
    end loop

    Assumptions: if you commit within the loop then you will be running n transactions so if you run it on a table which is being updated you may find that some records wont be processed even if they were added and committed before your procedure finishes.

    Last edited by AlanP; 10-29-03 at 07:42.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts