Query timeout using python influxdB_client

When query influxdb, chose query_raw:
result = query_api.query_raw(query, dialect=Dialect(header=True, delimiter=","
, comment_prefix="#", annotations=, date_time_format=“RFC3339”))
return timeout if data over 20 days(over 100,000 points), return nornal is query data of only a few days.
timeout return:
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host=‘localhost’, port=18086): Read timed out. (read timeout=9.98499999998603)

Hi @justin_zhang,

thanks for using our client. You have to increate the http timeout by:

InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", timeout=30_000)

Regards

1 Like

Hi, @bednar ,thanks for your answer, also I’m a little upset because the query speed of influxdb 2.0 open source is much more slower than which of version 1.7 or earlier version, so what’s the reason? The battleneck is influxdb service or client ?

It’s hard to say. You can look at this documentary: Hardware sizing guidelines | InfluxDB OSS 1.8 Documentation to see if you have the hardware correctly scaled.

How much time takes your query in InfluxDB UI?

almost same using UI
I think it’s influxdb service’s design problem.

You can try optimize your Flux query by following guide: Optimize Flux queries | InfluxDB Cloud Documentation

I optimized the query already using pivot, also query_raw, it helpful but still very slow compared with version 1.7 or earlier, open source 2.0 is the slowest database I had used, even compared with MySQL