Re:PostgREST – Serve a RESTful API from Any Postgres Database
by yladiz on Thursday December 29, 2022 @05:21PM
(#34178848)
I see. How do you determine when to kill the query before running it then? Of course you could do “if the process is running longer than X seconds kill and returns NNN status code” but that feels somewhat wasteful if you can be smarter when calculating the possible cost.
Re:PostgREST – Serve a RESTful API from Any Postgres Database
by zX41ZdbW on Saturday December 31, 2022 @11:49AM
(#34198185)
The cost can be calculated, but not always.
Example 1:
SELECT ... FROM table WHERE key BETWEEN c1 AND c2
- here we can get the number of records and bytes to scan before even starting the query.Example 2:
SELECT ... FROM table WHERE key = (SELECT ...)
- here we cannot know how many records will be scanned until we will finish the subquery.Maybe some estimations can be applied... but we don't do that.
For example, this query will not start, because the amount of rows to scan is greater than the limit: https://play.clickhouse.com/play?user=play#U0VMRUNUICogRlJPT...
This query will fail with the error: https://play.clickhouse.com/play?user=play#U0VMRUNUICogRlJPT...