Skip to main content
Neon Postgres Docs

Search documentation

Type to search this documentation.

On this pageOverview

Changelog 2023 08 16

The Neon serverless driver is a low-latency Postgres driver for JavaScript and TypeScript that allows you to query data from serverless and edge environments over HTTP or WebSockets in place of TCP.

The driver now supports batched queries and a larger response size for queries over HTTP.

You can now issue multiple queries at once in a single, non-interactive transaction using the transaction() function, which is exposed as property of the query function. For example:

JavaScript
import { neon } from '@neondatabase/serverless';
const sql = neon(process.env.DATABASE_URL);
const showLatestN = 10;

const [posts, tags] = await sql.transaction([
  sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`,
  sql`SELECT * FROM tags`,
]);

The transaction() function supports the same option keys the ordinary query function: arrayMode, fullResults, and fetchOptions, plus three additional keys for transaction configuration:

  • isolationMode

    Must be one of ReadUncommitted, ReadCommitted, RepeatableRead, or Serializable.

  • readOnly

    Ensures that a READ ONLY transaction is used to execute queries. The default value is false.

  • deferrable

    Ensures that a DEFERRABLE transaction is used to execute queries. The default value is false.

For more information, see transaction(...) function.

The maximum response size for queries over HTTP was raised from 1 MB to 10 MB.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu