<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Restrict certain queries on SQL Warehouse in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158873#M5325</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/126682"&gt;@sparkplug&lt;/a&gt;,&lt;/P&gt;
&lt;P data-pm-slice="1 1 []"&gt;If you are using a shared classic SQL warehouse, I would set expectations that the native controls are fairly limited. The publicly documented knobs are mainly around warehouse sizing and queuing behaviour, warehouse monitoring, and statement timeout, rather than per-user governance controls like rate limiting or SQL pattern blocking. You can see the documented warehouse behaviour &lt;A href="https://docs.databricks.com/aws/en/compute/sql-warehouse/warehouse-behavior" rel="noopener noreferrer nofollow" target="_blank"&gt;here&lt;/A&gt;, the monitoring options &lt;A href="https://docs.databricks.com/aws/en/compute/sql-warehouse/monitor" rel="noopener noreferrer nofollow" target="_blank"&gt;here&lt;/A&gt;, and the STATEMENT_TIMEOUT parameter &lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/parameters/statement_timeout" rel="noopener noreferrer nofollow" target="_blank"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P class="wnfdntt _1ibi0s3f5 _1ibi0s3ce _1ibi0s3ea"&gt;More specifically, I do not see a documented built-in setting on classic SQL warehouses to rate limit users based on how many queries they submit in a short period, to block arbitrary read-only statements such as SELECT 1, or to automatically cancel duplicate queued queries before they run. What you can do natively is monitor queued and running queries, adjust warehouse size and cluster counts, and set a statement timeout. That timeout can also be set at the session level, so it is not a hard, admin-only ceiling in the way you are looking for.&lt;/P&gt;
&lt;P class="wnfdntt _1ibi0s3f5 _1ibi0s3ce _1ibi0s3ea"&gt;If you need stricter controls, the pragmatic approach is usually to put a service or proxy in front of the warehouse and have that layer enforce per-user throttling, reject known keepalive patterns before submission, and detect duplicate queued requests. If you are submitting through the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/sql-execution-tutorial" rel="noopener noreferrer nofollow" target="_blank"&gt;Statement Execution API&lt;/A&gt;, you can also cancel statements programmatically using the cancel endpoint once your policy determines they should be stopped.&lt;/P&gt;
&lt;P class="wnfdntt _1ibi0s3f5 _1ibi0s3ce _1ibi0s3ea"&gt;In simple terms... on a shared classic warehouse, this is not something you can fully solve with warehouse settings alone. You can get part of the way there with timeout, monitoring, and right-sizing, but the more opinionated controls you listed generally need to be enforced outside the warehouse itself.&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2026 11:39:46 GMT</pubDate>
    <dc:creator>Ashwin_DSA</dc:creator>
    <dc:date>2026-06-12T11:39:46Z</dc:date>
    <item>
      <title>Restrict certain queries on SQL Warehouse</title>
      <link>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158858#M5321</link>
      <description>&lt;P&gt;We manage a databricks workspace where majority of the users are working, we haven't switched over to Serverless yet because there is lot of observability and control that is lacking. So we are still on one classic SQL warehouse which is shared among everyone, how can I implement restrictions such as&lt;BR /&gt;- Rate limit user queries in a short amount of time&lt;/P&gt;&lt;P&gt;- Not allowing certain queries to be run - example SELECT 1 - &amp;nbsp;people do this to keep the warehouse running&lt;/P&gt;&lt;P&gt;- Add a global restriction on statement_timeout - we have set this but it's easily overridden by the user&lt;/P&gt;&lt;P&gt;- Cancelling duplicate queued queries &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2026 07:22:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158858#M5321</guid>
      <dc:creator>sparkplug</dc:creator>
      <dc:date>2026-06-12T07:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict certain queries on SQL Warehouse</title>
      <link>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158861#M5322</link>
      <description>&lt;P&gt;You can implement a monitoring workflow that periodically scans query history for users issuing SET &lt;STRONG&gt;STATEMENT_TIMEOUT, SELECT Alive, Duplicate Query &amp;amp; Rate Limit&amp;nbsp;&lt;/STRONG&gt;statements. This can help identify users who are bypassing the globally configured default timeout allowing you to review their usage patterns and if necessary, remove access to the affected SQL Warehouse or move them to a separate warehouse with different governance controls. You can stop the long running / duplicate queries using the Execution_api interfaces in the workflow if required.&lt;/P&gt;&lt;P&gt;You can move to&amp;nbsp;&lt;STRONG&gt;Serverless &lt;/STRONG&gt;instead of&lt;STRONG&gt; Classic warehouses&lt;/STRONG&gt;&amp;nbsp;to avail cost &amp;amp; performance benefits.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Statement Timeout Offenders&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;SELECT
    executed_by,
    statement_id,
    start_time,
    statement_text
FROM system.query.history
WHERE lower(statement_text) RLIKE 'set\\s+statement_timeout'
ORDER BY start_time DESC;&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Select 1 statement Offenders&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;SELECT 
  statement_id, 
  executed_by, 
  warehouse_id
FROM 
  system.query.history
WHERE 
  AND REGEXP_LIKE(TRIM(LOWER(statement_text)), '^select\s+1\s*;?$')&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&amp;nbsp;Duplicate Query Offenders&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;WITH queued_queries AS (    
    SELECT 
      statement_id,
      executed_by,
      MD5(TRIM(LOWER(statement_text))) as query_hash,
      start_time
    FROM system.query.history
    WHERE execution_status = 'QUEUED'
)
SELECT 
  statement_id
FROM (
  SELECT 
    statement_id,
    ROW_NUMBER() OVER(PARTITION BY executed_by, query_hash ORDER BY start_time ASC) as occurrence
  FROM queued_queries
)
WHERE occurrence &amp;gt; 1&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Rate Limit Users&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;SELECT executed_by, COUNT(*) as queries_last_10_mins
FROM system.query.history
WHERE start_time &amp;gt;= NOW() - INTERVAL 10 MINUTE
GROUP BY executed_by
HAVING queries_last_10_mins &amp;gt; 100;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 12 Jun 2026 08:29:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158861#M5322</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-06-12T08:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict certain queries on SQL Warehouse</title>
      <link>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158872#M5324</link>
      <description>&lt;P&gt;These information is already available in the warehouse monitoring view that's why I was able to tell that users are running SELECT 1 queries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2026 11:31:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158872#M5324</guid>
      <dc:creator>sparkplug</dc:creator>
      <dc:date>2026-06-12T11:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict certain queries on SQL Warehouse</title>
      <link>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158873#M5325</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/126682"&gt;@sparkplug&lt;/a&gt;,&lt;/P&gt;
&lt;P data-pm-slice="1 1 []"&gt;If you are using a shared classic SQL warehouse, I would set expectations that the native controls are fairly limited. The publicly documented knobs are mainly around warehouse sizing and queuing behaviour, warehouse monitoring, and statement timeout, rather than per-user governance controls like rate limiting or SQL pattern blocking. You can see the documented warehouse behaviour &lt;A href="https://docs.databricks.com/aws/en/compute/sql-warehouse/warehouse-behavior" rel="noopener noreferrer nofollow" target="_blank"&gt;here&lt;/A&gt;, the monitoring options &lt;A href="https://docs.databricks.com/aws/en/compute/sql-warehouse/monitor" rel="noopener noreferrer nofollow" target="_blank"&gt;here&lt;/A&gt;, and the STATEMENT_TIMEOUT parameter &lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/parameters/statement_timeout" rel="noopener noreferrer nofollow" target="_blank"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P class="wnfdntt _1ibi0s3f5 _1ibi0s3ce _1ibi0s3ea"&gt;More specifically, I do not see a documented built-in setting on classic SQL warehouses to rate limit users based on how many queries they submit in a short period, to block arbitrary read-only statements such as SELECT 1, or to automatically cancel duplicate queued queries before they run. What you can do natively is monitor queued and running queries, adjust warehouse size and cluster counts, and set a statement timeout. That timeout can also be set at the session level, so it is not a hard, admin-only ceiling in the way you are looking for.&lt;/P&gt;
&lt;P class="wnfdntt _1ibi0s3f5 _1ibi0s3ce _1ibi0s3ea"&gt;If you need stricter controls, the pragmatic approach is usually to put a service or proxy in front of the warehouse and have that layer enforce per-user throttling, reject known keepalive patterns before submission, and detect duplicate queued requests. If you are submitting through the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/sql-execution-tutorial" rel="noopener noreferrer nofollow" target="_blank"&gt;Statement Execution API&lt;/A&gt;, you can also cancel statements programmatically using the cancel endpoint once your policy determines they should be stopped.&lt;/P&gt;
&lt;P class="wnfdntt _1ibi0s3f5 _1ibi0s3ce _1ibi0s3ea"&gt;In simple terms... on a shared classic warehouse, this is not something you can fully solve with warehouse settings alone. You can get part of the way there with timeout, monitoring, and right-sizing, but the more opinionated controls you listed generally need to be enforced outside the warehouse itself.&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2026 11:39:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/restrict-certain-queries-on-sql-warehouse/m-p/158873#M5325</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-06-12T11:39:46Z</dc:date>
    </item>
  </channel>
</rss>

