mymarilyn / clickhouse-driver

ClickHouse Python Driver with native interface support
https://clickhouse-driver.readthedocs.io
Other
1.18k stars 213 forks source link

clickhouse_driver.varint.read_varint is called recursively #408

Open vigneshshettyin opened 6 months ago

vigneshshettyin commented 6 months ago

Describe the bug Observed a case where when the query string is long, Package is taking more time to render data. Also ran a profiler and checked that database is returning result instantly (less than 500ms) but package is taking more 30-35 seconds.

To Reproduce Trigger API with higher query string (approx more than 575316)

Expected behavior Package should return response within 1 second

Versions

Please refer to https://github.com/jayvynl/django-clickhouse-backend/issues/70 as well

@jayvynl

xzkostyan commented 6 months ago

Hi.

Do you have any advices to achieve this speed? I've spent many hours on this thing and ended with pushing this code to cython. There are many places in binary protocol with numbers in LEB128. IMHO, this function is simple as it can be. The main time takes read_one function that reads one by one bytes from input stream.

vigneshshettyin commented 6 months ago

As of now, we don't have any solution. I am exploring stuff @xzkostyan