Skip to content

Support for multi-query statements #695

Open
@matthughes

Description

@matthughes

The postgres protocol supports sending multiple queries across different tables/views (separated by semi-colon) in one request and receiving the results. Currently Skunk explicitly does not support this:

From Query.scala

          case ReadyForQuery(_) =>
            new SkunkException(
              message   = "Multi-statement queries and commands are not supported.",
              hint      = Some("Break up semicolon-separated statements and execute them independently."),
              sql       = Some(stmt.sql),
              sqlOrigin = Some(stmt.origin),
            ).raiseError[F, Unit].whenA(multipleStatements)

Even if you have parallelizeable queries in a transaction, currently clients are forced to submit the queries one at a time, waiting for the results of the first query before submitting the second query. If you have a lot of queries and a decent amount of latency between your app/db servers this can add up.

I'm interested in adding support for this and am digging around but wouldn't mind if anyone had any pointers or reasons why this could never work with the Skunk model.

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