R2DBC - Question

52 views
Skip to first unread message

Kit Karson

unread,
May 10, 2024, 2:12:40 PM5/10/24
to r2dbc
Hi Mark,

I am looking for your help to understand how R2DBC-postgres driver works behind the scenes.

Lets take a simple example where I query for entire table "select * from customers" which has 1 million records.. What are the postgres provided techniques R2DBC uses to get the results more efficiently? 

As you know a subscriber / an operator can always cancel early. How does the driver handle this (I understand that If I need only 3 records i should include that part of the query itself. however I am giving this as an example to convey a problem)?

Mono.from(connectionFactory.create())
  .flatMapMany(connection -> connection
    .createStatement("SELECT * FROM CUSTOMERS")
    .execute())
  .flatMap(result -> .....)
  .doOnNext(System.out::println)
  .take(3)
  .subscribe();


I would appreciate your help. 
Reply all
Reply to author
Forward
0 new messages