Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-857660: Improve JSON performance #880

Closed
wants to merge 1 commit into from

Conversation

sfc-gh-pfus
Copy link
Collaborator

@sfc-gh-pfus sfc-gh-pfus commented Aug 7, 2023

Description

Before my change, for each row we tried to find out the location for string localisation (like formatting dates etc, even if it was not relevant). Checking location was easy if someone specified the location in the connection parameter, but if it was not (and I believe it is usual), we needed to guess this location. This involved very inefficient system call for each row and each column. I changed it so the location is cached for connection. The code handling JSON responses is like 30-50 times faster (!!!). Quick stats: before my change 1M rows (single column) was retrieved in 1,5min. After my changes it takes 3 seconds. In 1,5min we are able to handle nearly 50M of rows.

Checklist

  • Code compiles correctly
  • Run make fmt to fix inconsistent formats
  • Run make lint to get lint errors and fix all of them
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

@sfc-gh-pfus sfc-gh-pfus marked this pull request as ready for review August 7, 2023 12:58
@sfc-gh-pfus sfc-gh-pfus requested a review from a team as a code owner August 7, 2023 12:58
loc, err = time.LoadLocation(*tz)
if err != nil {
loc = time.Now().Location()
}
}
paramsMutex.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to take care of ALTER SESSION command changes some parameter like TIMEZONE? will it be change in the cache? Could you please add test case for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. With your question in my mind, I started from scratch: #882

@github-actions github-actions bot locked and limited conversation to collaborators Aug 11, 2023
@sfc-gh-pfus sfc-gh-pfus deleted the SNOW-857660-improve-json branch August 11, 2023 05:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants