title: Cancel current/active query in Ruby on Rails
body: <p>In my project I am running a massive query returning lots of data. Due to the size of this query, the runtime sometimes exceeds 1 minute. Ignoring other issues this may create, is there any way to cancel a currently running query?</p>
  
  <p>For example, the user starts the query and is redirected to a standard 'Loading Results...' page. If they then decide that they no longer want the results, they can click a 'Cancel' button which will somehow terminate the running query.</p>
  
  <p>Is this possible and how can it be done?</p>
  
  <p>Thanks!</p>