File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -404,6 +404,30 @@ read_stream_start_pending_read(ReadStream *stream)
404
404
static void
405
405
read_stream_look_ahead (ReadStream * stream )
406
406
{
407
+ /*
408
+ * Batch-submitting multiple IOs is more efficient than doing so
409
+ * one-by-one. If we just ramp up to the max, we'll only be allowed to
410
+ * submit one io_combine_limit sized IO. Defer submitting IO in that case.
411
+ *
412
+ * FIXME: This needs better heuristics.
413
+ */
414
+ #if 1
415
+ if (!stream -> sync_mode && stream -> distance > (io_combine_limit * 8 ))
416
+ {
417
+ if (stream -> pinned_buffers + stream -> pending_read_nblocks > ((stream -> distance * 3 ) / 4 ))
418
+ {
419
+ #if 0
420
+ ereport (LOG ,
421
+ errmsg ("reduce reduce reduce: pinned: %d, pending: %d, distance: %d" ,
422
+ stream -> pinned_buffers ,
423
+ stream -> pending_read_nblocks ,
424
+ stream -> distance ));
425
+ #endif
426
+ return ;
427
+ }
428
+ }
429
+ #endif
430
+
407
431
/*
408
432
* Allow amortizing the cost of submitting IO over multiple IOs. This
409
433
* requires that we don't do any operations that could lead to a deadlock
You can’t perform that action at this time.
0 commit comments