Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/api/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,15 @@ where

// Simple query has row_schema in query response. For extended query,
// row_schema is returned as response of `Describe`.
//
// Use `feed` rather than `send` so the whole response coalesces into the one
// terminal flush the connection loop already performs (`send_ready_for_query`
// for simple queries, `on_sync`/`on_flush` for extended). With TCP_NODELAY on,
// each `send` flush is its own `sendto`/segment.
if send_describe {
let row_desc = into_row_description(&row_schema);
client
.send(PgWireBackendMessage::RowDescription(row_desc))
.feed(PgWireBackendMessage::RowDescription(row_desc))
.await?;
}

Expand All @@ -589,7 +594,7 @@ where

let tag = Tag::new(&command_tag).with_rows(rows);
client
.send(PgWireBackendMessage::CommandComplete(tag.into()))
.feed(PgWireBackendMessage::CommandComplete(tag.into()))
.await?;

Ok(())
Expand Down Expand Up @@ -661,8 +666,10 @@ where
C::Error: Debug,
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
{
// Use `feed` rather than `send` so the CommandComplete coalesces with the
// trailing ReadyForQuery into one socket write (see `send_query_response`).
client
.send(PgWireBackendMessage::CommandComplete(tag.into()))
.feed(PgWireBackendMessage::CommandComplete(tag.into()))
.await?;

Ok(())
Expand Down
Loading