On Thu, 26 Apr 2018 23:32:33 +0300 Vitaliy Garnashevich <vgarnashevich@xxxxxxxxx> wrote: > The aggregated table has hundreds of millions of rows, and the query > runs for many hours (which is one of the reasons why it's better not > to fail). I really doubt that row level locking would work. That > would be a lot of RAM just to hold all the locks. All the more reason to use temp tables. -- Steven Lembark 1505 National Ave Workhorse Computing Rockford, IL 61103 lembark@xxxxxxxxxxx +1 888 359 3508