Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

zsand
Copy link
Contributor

@zsand zsand commented May 25, 2024

This commit adds the TCP_NODELAY option to the socket configuration in configure_socket function. Without this option, we observed significant performance issues when executing SELECT queries with large responses.

Before the fix:

postgres=> SELECT repeat('a', 1); SELECT repeat('a', 8153); 
Time: 1.368 ms
Time: 41.364 ms

After the fix:

postgres=> SELECT repeat('a', 1); SELECT repeat('a', 8153);
Time: 1.332 ms
Time: 1.528 ms

By setting TCP_NODELAY, we eliminate the Nagle's algorithm delay, which results in a substantial improvement in response times for large queries.

This problem was discussed in #616.

This commit adds the TCP_NODELAY option to the socket configuration in
`configure_socket` function. Without this option, we observed significant
performance issues when executing SELECT queries with large responses.

Before the fix:
postgres=> SELECT repeat('a', 1); SELECT repeat('a', 8153);
Time: 1.368 ms
Time: 41.364 ms

After the fix:
postgres=> SELECT repeat('a', 1); SELECT repeat('a', 8153);
Time: 1.332 ms
Time: 1.528 ms

By setting TCP_NODELAY, we eliminate the Nagle's algorithm delay, which
results in a substantial improvement in response times for large queries.

This problem was discussed in postgresml#616.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants