# \#sql

**URL:** https://community.questdb.com/tag/sql/1.md

[Latest](https://community.questdb.com/latest.md) · [Categories](https://community.questdb.com/categories.md) · [Tags](https://community.questdb.com/tags.md)

---

## [How to fix execution time discrepancy curl vs http?](https://community.questdb.com/t/how-to-fix-execution-time-discrepancy-curl-vs-http/989)

<div class="topic-metadata">

**Author:** [@YBrink](https://community.questdb.com/u/YBrink)\
**Replies:** 2\
**Last updated:** [May 12, 2026, 10:33am UTC](https://community.questdb.com/t/how-to-fix-execution-time-discrepancy-curl-vs-http/989 "2026-05-12T10:33:58Z")

</div>

I am attempting to run queries using a http client from within a .Net environment. The trouble I’m experiencing is noticeable delays in retrieving data; a delay that does not occur when using curl, or running the query …

---

## [Updating a column with an array of rows ](https://community.questdb.com/t/updating-a-column-with-an-array-of-rows/920)

<div class="topic-metadata">

**Author:** [@Janu](https://community.questdb.com/u/Janu)\
**Replies:** 1\
**Last updated:** [September 27, 2025, 12:51pm UTC](https://community.questdb.com/t/updating-a-column-with-an-array-of-rows/920 "2025-09-27T12:51:05Z")

</div>

Hi. I have prices stored within a certain time period that need to be updated, it is a lot of rows, and I therefor do not want to update each row individually. Is it possible to use the UPDATE statement with an array o…

---

## [Calculating mode (most frequent digit)](https://community.questdb.com/t/calculating-mode-most-frequent-digit/908)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 6\
**Last updated:** [September 2, 2025, 11:19am UTC](https://community.questdb.com/t/calculating-mode-most-frequent-digit/908 "2025-09-02T11:19:30Z")

</div>

Guys, consider I have the following column, whats the best approach to calculate the statistical mode of each row? e.g 1251223 would give me mode of 2.

---

## [Select nearest timestamp from multiple tables](https://community.questdb.com/t/select-nearest-timestamp-from-multiple-tables/885)

<div class="topic-metadata">

**Author:** [@jmthomas](https://community.questdb.com/u/jmthomas)\
**Replies:** 4\
**Last updated:** [July 15, 2025, 10:33am UTC](https://community.questdb.com/t/select-nearest-timestamp-from-multiple-tables/885 "2025-07-15T10:33:32Z")

</div>

I’m trying to select from multiple tables values closest (\<=) to the given timestamp. For example in the demo how would I select a few columns from one table and a few columns from another where the timestamp is closest …

---

## [Math operations with lag()](https://community.questdb.com/t/math-operations-with-lag/820)

<div class="topic-metadata">

**Author:** [@vins](https://community.questdb.com/u/vins)\
**Replies:** 21\
**Last updated:** [June 17, 2025, 12:07pm UTC](https://community.questdb.com/t/math-operations-with-lag/820 "2025-06-17T12:07:16Z")

</div>

i have a questdb 8.3.0 and i want to graph a typical snmp counter containing network incoming traffic (ifHCInOctets). if i run this query: SELECT timestamp, ifDescr, ifHCInOctets, (LAG(ifHCInOctets,1)…

---

## [Is there a way to LAG() with VARCHAR data?](https://community.questdb.com/t/is-there-a-way-to-lag-with-varchar-data/855)

<div class="topic-metadata">

**Author:** [@germsvel](https://community.questdb.com/u/germsvel)\
**Replies:** 2\
**Last updated:** [June 11, 2025, 2:39pm UTC](https://community.questdb.com/t/is-there-a-way-to-lag-with-varchar-data/855 "2025-06-11T14:39:02Z")

</div>

:waving\_hand: hi there, I’m trying out QuestDB for the first time, so this testing is in dev (i.e. not sure if the enterprise edition has differences). One of the things I’m trying to do is find rows in a dataset whose…

---

## [Which strategy with this Use Case](https://community.questdb.com/t/which-strategy-with-this-use-case/811)

<div class="topic-metadata">

**Author:** [@alb](https://community.questdb.com/u/alb)\
**Replies:** 6\
**Last updated:** [April 22, 2025, 5:52pm UTC](https://community.questdb.com/t/which-strategy-with-this-use-case/811 "2025-04-22T17:52:25Z")

</div>

Hi all, I’m a beginner with QuestDB, and I found it very interesting!! I would like to understand if can solve issues in huge archiving data and performance quering I have data file CSV with 230 Million of rows daily …

---

## [How to compute and expand average power over time?](https://community.questdb.com/t/how-to-compute-and-expand-average-power-over-time/799)

<div class="topic-metadata">

**Author:** [@alexcode](https://community.questdb.com/u/alexcode)\
**Replies:** 6\
**Last updated:** [April 11, 2025, 4:00pm UTC](https://community.questdb.com/t/how-to-compute-and-expand-average-power-over-time/799 "2025-04-11T16:00:52Z")

</div>

I’m working with a dataset where an IoT device sends a wh (watt-hour) value at discrete timestamps, identified by an operationId. I want to visualize this data by plotting the sum of average power per operation, broken d…

---

## [Enabling jit on sql queries](https://community.questdb.com/t/enabling-jit-on-sql-queries/728)

<div class="topic-metadata">

**Author:** [@ack22](https://community.questdb.com/u/ack22)\
**Replies:** 21\
**Last updated:** [March 4, 2025, 3:15pm UTC](https://community.questdb.com/t/enabling-jit-on-sql-queries/728 "2025-03-04T15:15:51Z")

</div>

Hi, How can I ensure JIT is enabled on the SQL queries? I have set the server.conf property but still find that its not working as intended. Also, I see that jit flag is set to false for all queries that I am sending f…

---

## [URL encode a column value?](https://community.questdb.com/t/url-encode-a-column-value/760)

<div class="topic-metadata">

**Author:** [@cardilloscreations](https://community.questdb.com/u/cardilloscreations)\
**Replies:** 4\
**Last updated:** [February 21, 2025, 5:21pm UTC](https://community.questdb.com/t/url-encode-a-column-value/760 "2025-02-21T17:21:03Z")

</div>

I am trying to build a Superset view based on my QuestDB data. I store some URLs that I need to translate to encoded values to create an image URL to a hosted service, so my URL needed to be encoded to make that request.…

---

## [QuestDB Timestamp in Node.js](https://community.questdb.com/t/questdb-timestamp-in-node-js/747)

<div class="topic-metadata">

**Author:** [@jsmart](https://community.questdb.com/u/jsmart)\
**Replies:** 2\
**Last updated:** [February 12, 2025, 3:09pm UTC](https://community.questdb.com/t/questdb-timestamp-in-node-js/747 "2025-02-12T15:09:55Z")

</div>

When I execute the following query in the QuestDB panel (localhost:9000), it returns the correct timestamp: 2024-01-01T00:00:00.000000Z (UTC, as recorded). SELECT timestamp, first(open) AS open, max(high) AS…

---

## [Insert Performance Degradation](https://community.questdb.com/t/insert-performance-degradation/746)

<div class="topic-metadata">

**Author:** [@jsmart](https://community.questdb.com/u/jsmart)\
**Replies:** 5\
**Last updated:** [February 11, 2025, 4:01pm UTC](https://community.questdb.com/t/insert-performance-degradation/746 "2025-02-11T16:01:57Z")

</div>

HI I’m loading daily Klines archives from Binance (https://data.binance.vision/data/futures/um/daily/klines/${symbol}/1m/${file}) in a 1-minute interval. Each file contains 1440 candles, which I insert into the database…

---

## [A simple select on a table shows a red x icon but no error information](https://community.questdb.com/t/a-simple-select-on-a-table-shows-a-red-x-icon-but-no-error-information/729)

<div class="topic-metadata">

**Author:** [@truedatdat](https://community.questdb.com/u/truedatdat)\
**Replies:** 8\
**Last updated:** [February 5, 2025, 1:56pm UTC](https://community.questdb.com/t/a-simple-select-on-a-table-shows-a-red-x-icon-but-no-error-information/729 "2025-02-05T13:56:01Z")

</div>

I have a well formed table that I created using CSV import. Over time, I assume some bad data comes in, as I can no longer run select \* from mytable This shows a red X in the web UI , but the column shows , and I can …

---

## [Is there LAG window function or equivalent in QuestDB?](https://community.questdb.com/t/is-there-lag-window-function-or-equivalent-in-questdb/39)

<div class="topic-metadata">

**Author:** [@system](https://community.questdb.com/u/system)\
**Replies:** 4\
**Last updated:** [January 29, 2025, 3:15pm UTC](https://community.questdb.com/t/is-there-lag-window-function-or-equivalent-in-questdb/39 "2025-01-29T15:15:53Z")

</div>

I’m trying to query the diff between row values, in SQL it would be something like SELECT timestamp, price - LAG(price) OVER (ORDER BY timestamp) as price\_diff from trades But QuestDB returns Window function expected e…

---

## [SELECT from multiple timeseries tables with the same query](https://community.questdb.com/t/select-from-multiple-timeseries-tables-with-the-same-query/251)

<div class="topic-metadata">

**Author:** [@fgnm](https://community.questdb.com/u/fgnm)\
**Replies:** 17\
**Last updated:** [December 31, 2024, 1:18am UTC](https://community.questdb.com/t/select-from-multiple-timeseries-tables-with-the-same-query/251 "2024-12-31T01:18:25Z")

</div>

Hello! I have a timeseries database with financial data in which each table represent a financial asset price over the time. All tables have the same structure (symbol, timestamp, bid and ask). This database is part of …

---

## [Getting distinct dates from a timestamp column](https://community.questdb.com/t/getting-distinct-dates-from-a-timestamp-column/279)

<div class="topic-metadata">

**Author:** [@ack22](https://community.questdb.com/u/ack22)\
**Replies:** 3\
**Last updated:** [December 12, 2024, 9:09am UTC](https://community.questdb.com/t/getting-distinct-dates-from-a-timestamp-column/279 "2024-12-12T09:09:42Z")

</div>

Hi, I have a timestamp ‘st’ column which is used as a partition ‘day’ column as well. I am looking to find the distinct dates for when the data was stored. I am looking for something like: SELECT DISTINCT CAST(st as DA…

---

## [Cumulative product / multiply](https://community.questdb.com/t/cumulative-product-multiply/280)

<div class="topic-metadata">

**Author:** [@ack22](https://community.questdb.com/u/ack22)\
**Replies:** 1\
**Last updated:** [December 9, 2024, 9:44pm UTC](https://community.questdb.com/t/cumulative-product-multiply/280 "2024-12-09T21:44:37Z")

</div>

Hi, Is there a support for math functions like exp, ln, log, etc.? I need to compute a cumulative product for applying corporate actions (splits) on raw prices. Also, is there a way to create dynamics views? Would ne…

---

## [Comparing symbol columns](https://community.questdb.com/t/comparing-symbol-columns/250)

<div class="topic-metadata">

**Author:** [@ack22](https://community.questdb.com/u/ack22)\
**Replies:** 5\
**Last updated:** [December 9, 2024, 9:27pm UTC](https://community.questdb.com/t/comparing-symbol-columns/250 "2024-12-09T21:27:42Z")

</div>

Hi, I am encountering a strange issue when comparing 2 symbol columns. for example: select \* from table1 where symbol1 != symbol2 returns rows where symbol1 is exactly the same value as symbol2. If I cast either one o…

---

## [What are the implementation strategies for K-line data filling?](https://community.questdb.com/t/what-are-the-implementation-strategies-for-k-line-data-filling/258)

<div class="topic-metadata">

**Author:** [@laulee5135](https://community.questdb.com/u/laulee5135)\
**Replies:** 2\
**Last updated:** [December 4, 2024, 3:19am UTC](https://community.questdb.com/t/what-are-the-implementation-strategies-for-k-line-data-filling/258 "2024-12-04T03:19:01Z")

</div>

Hello, everyone. I am researching QuestDB for my company, focusing on handling various query scenarios and storing K-line data. I encountered a problem and would like to ask for help on how to implement it: The problem …

---

## [SELECT statement from a list of values as a temporary table](https://community.questdb.com/t/select-statement-from-a-list-of-values-as-a-temporary-table/224)

<div class="topic-metadata">

**Author:** [@LucaBonaldoIT](https://community.questdb.com/u/LucaBonaldoIT)\
**Replies:** 3\
**Last updated:** [November 11, 2024, 11:04am UTC](https://community.questdb.com/t/select-statement-from-a-list-of-values-as-a-temporary-table/224 "2024-11-11T11:04:45Z")

</div>

I’d like to be able to get the same result as the following query using the QuestDB connector for SQLAlchemy: SELECT MyData.Column1, MyData.Column2 FROM (VALUES(1, 'Tom'), (2, 'Dick'), …

---

## [Cumulative product for a random walk](https://community.questdb.com/t/cumulative-product-for-a-random-walk/167)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 1\
**Last updated:** [September 9, 2024, 9:27am UTC](https://community.questdb.com/t/cumulative-product-for-a-random-walk/167 "2024-09-09T09:27:28Z")

</div>

I have a dataset in QuestDB with daily returns for a stock, starting at $100. I want to calculate the cumulative product of the returns to simulate the stock’s price path (random walk). The daily returns are stored in a …

---

## [SQL format for converting to microseconds?](https://community.questdb.com/t/sql-format-for-converting-to-microseconds/82)

<div class="topic-metadata">

**Author:** [@tolland](https://community.questdb.com/u/tolland)\
**Replies:** 3\
**Last updated:** [September 2, 2024, 11:09am UTC](https://community.questdb.com/t/sql-format-for-converting-to-microseconds/82 "2024-09-02T11:09:49Z")

</div>

I followed this tutorial and noticed that my timestamps were wrong in the database; "stock\_symbol","current\_price","high\_price","low\_price","open\_price","percent\_change","tradets","ts" "EBAY",52.79,52.915,52.39,52.81,52…

---

## [Better spatial queries - Will polygon ever be supported?](https://community.questdb.com/t/better-spatial-queries-will-polygon-ever-be-supported/157)

<div class="topic-metadata">

**Author:** [@LucaBonaldoIT](https://community.questdb.com/u/LucaBonaldoIT)\
**Replies:** 5\
**Last updated:** [August 28, 2024, 11:09am UTC](https://community.questdb.com/t/better-spatial-queries-will-polygon-ever-be-supported/157 "2024-08-28T11:09:27Z")

</div>

Hello everyone, I find QuestDB incredibly fast and powerful, really happy in the choice of migrating so far. The only aspect I’m a little sad about is the impossibility of making spatial queries using a polygon as a ma…

---

## [Plotting overlayed data from past week](https://community.questdb.com/t/plotting-overlayed-data-from-past-week/147)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 6:18pm UTC](https://community.questdb.com/t/plotting-overlayed-data-from-past-week/147 "2024-08-13T18:18:58Z")

</div>

I have this very simple query below. I can add it to my Grafana and plot a chart representing the activity in 1 hour intervals, and if I add a time filter, I can scope it to today. All good. SELECT timestamp as time, se…

---

## [Funnel or Sankey diagram from flat events table](https://community.questdb.com/t/funnel-or-sankey-diagram-from-flat-events-table/146)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 6:14pm UTC](https://community.questdb.com/t/funnel-or-sankey-diagram-from-flat-events-table/146 "2024-08-13T18:14:59Z")

</div>

I am trying to build a user-flow or sankey diagram so I could find out what are the visited pages based on visitor\_id or pathname. I would like to be able to see which pages contribute visits to others, and in which prop…

---

## [I want to display a timestamp in my timezone, not UTC](https://community.questdb.com/t/i-want-to-display-a-timestamp-in-my-timezone-not-utc/145)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 6:12pm UTC](https://community.questdb.com/t/i-want-to-display-a-timestamp-in-my-timezone-not-utc/145 "2024-08-13T18:12:57Z")

</div>

I understand when I ingest data into QuestDB, the timestamps are always stored as UTC. This is all good, I get it, but I would like to see the timestamps in my local time zone. I live in Central Europe, my clock says rig…

---

## [Three aggregate functions, only one of them with conditions](https://community.questdb.com/t/three-aggregate-functions-only-one-of-them-with-conditions/144)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 6:12pm UTC](https://community.questdb.com/t/three-aggregate-functions-only-one-of-them-with-conditions/144 "2024-08-13T18:12:03Z")

</div>

I want to run three aggregations (max, avg, min) in one questdb query, but the last of the aggregations should have a where condition that does not affect the others. I tried a query that works but it gives me three ro…

---

## [Get totals for top 5 elements in GROUP BY, and then the rest of the groups in a single total](https://community.questdb.com/t/get-totals-for-top-5-elements-in-group-by-and-then-the-rest-of-the-groups-in-a-single-total/88)

<div class="topic-metadata">

**Author:** [@javier](https://community.questdb.com/u/javier)\
**Replies:** 2\
**Last updated:** [July 10, 2024, 9:41am UTC](https://community.questdb.com/t/get-totals-for-top-5-elements-in-group-by-and-then-the-rest-of-the-groups-in-a-single-total/88 "2024-07-10T09:41:57Z")

</div>

I have a question. I have the following scheme CREATE TABLE 'redirect3' ( id INT, short\_url\_id INT, browser SYMBOL capacity 256 CACHE, platform SYMBOL capacity 256 CACHE, os SYMBOL capacity 256 CACHE, referr…

---

## [How to find elapsed time using window functions](https://community.questdb.com/t/how-to-find-elapsed-time-using-window-functions/71)

<div class="topic-metadata">

**Author:** [@system](https://community.questdb.com/u/system)\
**Replies:** 1\
**Last updated:** [July 3, 2024, 3:54pm UTC](https://community.questdb.com/t/how-to-find-elapsed-time-using-window-functions/71 "2024-07-03T15:54:28Z")

</div>

As the title says, when using a window function, is there a way to find out the elapsed time?

---

## [How to await for rows ingested to WAL table to become visible in QuestDB?](https://community.questdb.com/t/how-to-await-for-rows-ingested-to-wal-table-to-become-visible-in-questdb/48)

<div class="topic-metadata">

**Author:** [@system](https://community.questdb.com/u/system)\
**Replies:** 1\
**Last updated:** [June 26, 2024, 6:45pm UTC](https://community.questdb.com/t/how-to-await-for-rows-ingested-to-wal-table-to-become-visible-in-questdb/48 "2024-06-26T18:45:09Z")

</div>

I’m running a single-time QuestDB ingestion for a large data volume. I’m using InfluxDB Line Protocol, and the table uses Write-Ahead Log (WAL). Since inserts are asynchronous, I want to ensure that all ingested rows are…

[Next page](https://community.questdb.com/tag/sql/1.md?match_all_tags=true&page=1&tags%5B%5D=sql)
