
Better query killing
We tuned up the heuristics for handling abandoned queries to make sure we keep the database load as light as possible and optimize performance.
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
All righty. Um, this in in spirit of my demo last week is another basically non-demo, but um I wanted to sort of show off something that um that that worked on this week. Um, one of the problems that we've noticed is that one of the APIs that we use in the browser to detect when you don't care about a query anymore, um, navigation away or um, you're closing a tab is a little bit unreliable.
You know, we have to be able to determine uh, when you don't care about the query. So, I added a secondary mechanism to um, to detect query abandonment. um that should hopefully allow for us to uh catch with a little bit more tolerance here, but queries that just are we're never going to look at the the the result of.
So, what I'm going to do here is I'm going to run a query. This takes about 100 seconds. Now, I'm cheating a little bit because it's hard to demo this behavior to show off this particular one without um turning off my network or something like that. So, what you can see here is the query is running. I've actually cancelled the the follow-up request that will trigger this behavior.
So, like let's assume that it don't show up anymore. And what's going to happen is after some amount of time. So, I'm refreshing my page here. So, it's around it's between 20 and 30 seconds after we determine that the query is abandoned. So, at this point, we might start to see it disappear. And what the idea is as soon as we determine that it is not um alive anymore, we'll give it a little bit of a threshold and see it now.
Now, now it canceled. So, about 10. So that first request that lasts for about 10 seconds. It says, "I'm waiting for results." And when we don't hear back from it for 20 seconds, we'll start the process to cancel it. So it gives us a little bit of of extra time um to just in case you come back, you know, you had a little network hiccup or something like that, but we want to make sure that um we don't have a bunch of queries running on the data warehouse um that are no longer relevant.
And this kind of gives us an additional way to make sure that we're catching those abandoned queries.