Imagine I allow our users to enter search terms. Typically, a search term would lead to our database returning a handful of thousand rows, and the result set returns very quickly. But it's possible to send in silly search requests that end up returning pretty much all the data in the system. Think, for example, a search query searching for the substring "e" in rows containing English text. Such a query could run for 30 seconds and cause the system to appear slow.
So wouldn't it be great if you could write a query like "SELECT ...columns... FROM ...whatever... WHERE ...criteria ... ... WITHIN N seconds. It runs the query for N seconds and it returns whatever it managed to gather within those N seconds, regardless of whether the full query has completed or not.
Is this possible? Without the use of cursors or some such evil?