@@ -367,6 +367,7 @@ impl SourceIndexingContext {
367367 self : & Arc < Self > ,
368368 pool : & PgPool ,
369369 update_stats : & Arc < stats:: UpdateStats > ,
370+ expect_little_diff : bool ,
370371 ) -> Result < ( ) > {
371372 let pending_update_fut = {
372373 let mut pending_update = self . pending_update . lock ( ) . unwrap ( ) ;
@@ -383,7 +384,8 @@ impl SourceIndexingContext {
383384 let mut pending_update = slf. pending_update . lock ( ) . unwrap ( ) ;
384385 * pending_update = None ;
385386 }
386- slf. update_once ( & pool, & update_stats) . await ?;
387+ slf. update_once ( & pool, & update_stats, expect_little_diff)
388+ . await ?;
387389 }
388390 anyhow:: Ok ( ( ) )
389391 } ) ;
@@ -406,17 +408,18 @@ impl SourceIndexingContext {
406408 self : & Arc < Self > ,
407409 pool : & PgPool ,
408410 update_stats : & Arc < stats:: UpdateStats > ,
411+ expect_little_diff : bool ,
409412 ) -> Result < ( ) > {
410413 let plan = self . flow . get_execution_plan ( ) . await ?;
411414 let import_op = & plan. import_ops [ self . source_idx ] ;
412- let rows_stream = import_op
413- . executor
414- . list ( & interface :: SourceExecutorReadOptions {
415- include_ordinal : true ,
416- include_content_version_fp : true ,
417- include_value : true ,
418- } )
419- . await ?;
415+ let read_options = interface :: SourceExecutorReadOptions {
416+ include_ordinal : true ,
417+ include_content_version_fp : true ,
418+ // When only a little diff is expected and the source provides ordinal, we don't fetch values during `list()` by default ,
419+ // as there's a high chance that we don't need the values at all
420+ include_value : ! ( expect_little_diff && import_op . executor . provides_ordinal ( ) ) ,
421+ } ;
422+ let rows_stream = import_op . executor . list ( & read_options ) . await ?;
420423 self . update_with_stream ( import_op, rows_stream, pool, update_stats)
421424 . await
422425 }
0 commit comments