4 ms·
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 retu
by yladiz 4y ago
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.
- zX41ZdbW 4y agoThe 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.