trino-python-client icon indicating copy to clipboard operation
trino-python-client copied to clipboard

Provide an option to use orjson instead of json

Open yuokada opened this issue 6 months ago • 2 comments

Description

orjson is a fast JSON library in Python. https://github.com/ijl/orjson?tab=readme-ov-file#performance

In my usage, json.loads() is one of the bottlenecks in performance when fetching a large result from a query.

Non-technical explanation

  • Provide an option to use orjson instead of json for faster query result fetching.

Release notes

( ) This is not user-visible or docs only and no release notes are required. (X) Release notes are required, please propose a release note for me. ( ) Release notes are required, with the following suggested text:

* Fix some things. ({issue}`issuenumber`)

yuokada avatar May 29 '25 09:05 yuokada

The purpose to use orjson is mainly to fasten the process of fetching query results from Trino servers. https://github.com/ijl/orjson

This PR is still a draft. I have to fix the CI failures. I'm going to write the description before making this PR ready for review.

yuokada avatar May 29 '25 09:05 yuokada

thanks, it would also be helpful to see some measurements with and without this change to get an idea of the impact.

hashhar avatar Jun 02 '25 13:06 hashhar

Good Point !

I test on Python 3.13 with 3.96 MB JSON file in Jupyter notebook. And found that the orjson has significant improvement.

image

dingo4dev avatar Jul 03 '25 10:07 dingo4dev

Maybe, superceded by #576

yuokada avatar Aug 01 '25 14:08 yuokada