# HTTP vs. WebSockets: Which protocol for your Postgres queries at the Edge

DevFeed: [HTTP vs. WebSockets: Which protocol for your Postgres queries at the Edge](<https://devfeed.tech/articles/http-vs-websockets-which-protocol-for-your-postgres-queries-at-the-edge-5424.md>)

Original publisher: [Read original article](<https://neon.com/blog/http-vs-websockets-for-postgres-queries-at-the-edge>)

Author: Raouf Chebri

Published: 2023-07-11T12:54:53Z

Content type: article

Language: en

Sources: [Blog -- Neon Docs](<https://devfeed.tech/sources/blog-neon-docs.md>)

Topics: [WebSocket](<https://devfeed.tech/topics/websocket.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Protocol (disambiguation)](<https://devfeed.tech/topics/protocol.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [Vercel](<https://devfeed.tech/topics/vercel.md>)

Tags: [engineering](<https://devfeed.tech/tags/engineering.md>), [http](<https://devfeed.tech/tags/http.md>), [latency](<https://devfeed.tech/tags/latency.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [serverless](<https://devfeed.tech/tags/serverless.md>), [sql](<https://devfeed.tech/tags/sql.md>), [transactions](<https://devfeed.tech/tags/transactions.md>), [vercel](<https://devfeed.tech/tags/vercel.md>)

## AI overview

The article compares SQL-over-HTTP and WebSockets for executing Postgres queries from Edge Functions. It explains that WebSockets preserve Postgres compatibility but can incur extra network round-trips, while HTTP performs better for simple one-shot queries. The reported tests found that repeated WebSocket queries had low latency, whereas single-shot queries were slower, and the article describes experiments in Vercel Edge and Serverless environments.

## Source excerpt

Faster is always better, especially when executing SQL queries. We recently introduced SQL-over-HTTP to our driver, which previously only supported WebSockets. Why did we do that? And which approach is faster? Our journey developing the WebSockets serverless driver We first devel...