Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Idea: do use unnamed statements for extended query requests if feasible. #1044

Open
@fritshoogland-yugabyte

Description

All query methods exceptsimple_query andbatch_execute use the postgres extended query protocol.

The extended query protocol implementation of rust-postgres currently performs execution in 3 network roundtrips:

  1. Parse, which creates a "named statement"/"prepared statement"
  2. Bind and Execute, which performs the planning and execution of the statement
  3. Close, which removes the prepared statement.

This can be reduced to 2 network roundtrips by not performing the prepared statement creation.

When an extended query statement is not prepared or named, it will use a so-called 'unnamed statement'. An unnamed statement essentially performs a lot of the same work of a named statement, with the striking difference that the unnamed statement does not need to be closed, and is automatically destroyed by the next parse or simply query execution.

There are two cases known to me currently that requires a named statement/prepared statement to exist:

  • When a statement is explicitly prepared.
  • When statements are pipelined, these have to be named in order to guarantee taking the correct query.

As far as I know currently in all other situations an unnamed statement would work fine.

Reference:#1017

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp