anchor.diff:  estimate_query_size(#state{total_query_data  = CurrentTotalSize,
                              n_subqueries_done = NSubqueriesDone,
                              max_query_data    = MaxQueryData,
  -                           qbuf_ref = QBufRef,
  -                           orig_qry = ?SQL_SELECT{'LIMIT' = Limit}} = State)
  +                           qbuf_ref          = QBufRef,
  +                           sub_qrys          = SubQrys,
  +                           qry = ?SQL_SELECT{'LIMIT' = Limit} = OrigQry} = State)
     when QBufRef /= undefined,
          is_integer(Limit) ->
       %% query buffer-backed, has a LIMIT: consider the latter
       BytesPerChunk = CurrentTotalSize / NSubqueriesDone,
  -    ProjectedLimitData = Limit * BytesPerChunk,
  +    ProjectedLimitData = round(Limit * BytesPerChunk),
       if ProjectedLimitData > MaxQueryData ->
  +            lager:info("Cancelling LIMIT ~b query because projected result size exceeds limit (~b > ~b, subqueries ~b of ~b done, query ~p)",
  +                       [Limit, ProjectedLimitData, MaxQueryData, NSubqueriesDone, length(SubQrys), OrigQry]),
               cancel_error_query(select_result_too_big, State);
          el/=se ->
               State
  
positive.code:           %% accumulated in memory:
            result             = []                   :: rows_acc() | aggregate_acc() | group_by_acc(),
            %% Query buffer support
            qbuf_ref                 :: undefined | riak_kv_qry_buffers:qbuf_ref(),
            orig_qry                 :: undefined | ?SQL_SELECT{}
           }).
  
  %%%===================================================================
  
negative.code: estimate_query_size(#state{total_query_data  = CurrentTotalSize,
                             n_subqueries_done = NSubqueriesDone,
                             max_query_data    = MaxQueryData,
                             sub_qrys          = SubQrys,
                             qry               = OrigQry} = State) ->
      BytesPerChunk = CurrentTotalSize / NSubqueriesDone,
      ProjectedGrandTotal = round(CurrentTotalSize + BytesPerChunk * length(SubQrys)),
      if ProjectedGrandTotal > MaxQueryData ->
              lager:info("Cancelling regular query because projected result size exceeds limit (~b > ~b, subqueries ~b of ~b done, query ~p)",
                         [ProjectedGrandTotal, MaxQueryData, NSubqueriesDone, length(SubQrys), OrigQry]),
              cancel_error_query(select_result_too_big, State);
         el/=se ->
              State
  