SQL-over-HTTP has been added to the Neon driver, which previously only supported WebSockets, for querying Postgres databases closer to end-users. WebSockets excel in maintaining consistent connections, offering low latencies for sustained queries but perform slower for single-shot queries. By contrast, HTTP is quicker for single-shot queries but lacks features like session support and interactive transactions. To strike a balance, connection caching was introduced, speeding up HTTP queries by around 10ms. The choice between HTTP and WebSockets depends on query type, user location, and specific APIs used.

5m read timeFrom neon.tech
Post cover image
Table of contents
Our journey developing the WebSockets serverless driverExperimenting with HTTPHTTP vs. WebSockets performanceConnection cache for SQL-over-HTTP queriesConclusion

Sort: