ARTICLE AD BOX
I need to extract from an InfluxDB3 Enterprise table with
17 Rows 40 columns four of which tagsthe datetime of the youngest and oldest rows. My expetation was that this would have been extremelly fast being InfluxDB optimized for timeseries. On countrary, I'm experiencing a big trouble since it takes, on my PC, more than four minutes and a lot of memory. One of the queries I am trying on a Jupyter Notebook is the following one
from influxdb_client_3 import InfluxDBClient3 import time # Config influx_token = '[YOUR_TOKEN]' influx_url = "http://127.0.0.1:8181" influx_bucket = "[your_bucket]" client = InfluxDBClient3( host=influx_url, token=influx_token, database=influx_bucket ) measurement = "XOM-option-5m" query = f'SELECT FIRST(bid), LAST(bid) FROM "{measurement}"' print(f"[QUERY] {query}") t0 = time.time() result = client.query(query, language="influxql") # <-- CRITICAL: language="influxql" elapsed = time.time() - t0 df = result.to_pandas() if hasattr(result, "to_pandas") else result print(f"\n[RESULT] Elapsed: {elapsed:.2f}s") print(f"[RESULT] Shape: {df.shape}") print(f"[RESULT] Columns: {list(df.columns)}") print(f"\n[RESULT] Data:") print(df)Hope I am wronging somethig otherwise it means I wrong to choose InfluxDB at all!!!
Thanks.
6333 gold badges9 silver badges23 bronze badges
Explore related questions
See similar questions with these tags.
