cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

DBeaver Connection to DBX UC Triggering Queries and SQL Pro Warehouse Failure โ€“EC instances Remain

vkondepati
Databricks Partner

Hi Databricks Community,

I'm experiencing an unusual issue when connecting DBeaver to Databricks Unity Catalog (UC) through a SQL Pro Warehouse and would appreciate insights from anyone who has encountered similar behavior.

Current Setup

  • Client: DBeaver

  • Platform: Databricks on AWS

  • Catalog: Unity Catalog

  • Compute: Databricks SQL Pro Warehouse

Issue 1: Queries Executing Without User Interaction

When I establish a connection from DBeaver to Databricks Unity Catalog, I notice that queries are being submitted to the SQL Pro Warehouse even though I haven't manually executed any SQL statements.

This appears to generate unnecessary query activity and eventually overload the SQL warehouse.

I'm wondering whether DBeaver is automatically executing metadata discovery queries, catalog/schema introspection, or background queries.

Issue 2: SQL Warehouse Failure and EC2 Instances Remaining Active

While troubleshooting the above issue, I attempted to stop and restart the SQL Pro Warehouse.

However, I observed the following behavior:

  1. The Databricks compute transitioned into a Failed state.

  2. The underlying AWS EC2 instances continued running for an extended period.

  3. The instances did not appear to terminate promptly, even though the Databricks compute was no longer operational.

This raises concerns about compute lifecycle management, resource utilization, and potentially unnecessary AWS infrastructure costs.

Questions for the Community

  1. DBeaver Background Queries: Is it expected for DBeaver to automatically trigger SQL queries when connecting to Unity Catalog? Are there recommended DBeaver settings to limit metadata discovery or background queries?

  2. SQL Pro Warehouse Performance: Has anyone experienced high query volume or warehouse overload caused by JDBC clients such as DBeaver?

  3. Warehouse Lifecycle: What could cause a SQL Pro Warehouse to enter a Failed state during a stop/restart operation while its underlying EC2 instances remain active?

  4. EC2 Resource Cleanup: What is the expected behavior for EC2 instance termination when a SQL Pro Warehouse fails or is stopped? Is there a recommended way to verify that resources are released properly?

  5. Best Practices: Are there recommended JDBC connection properties, DBeaver configurations, or Databricks warehouse settings to prevent unnecessary background queries and manage compute resources efficiently?

Expected Behavior

Ideally, connecting DBeaver to Unity Catalog should not generate excessive background query activity, and stopping or restarting a SQL warehouse should result in predictable resource cleanup.

I'd be interested to hear whether others have encountered similar issues and what configuration changes or troubleshooting steps helped resolve them.

Thanks in advance for your suggestions!

Tags: Databricks, Unity Catalog, DBeaver, SQL Warehouse, SQL Pro, JDBC, AWS, Performance, Compute Management

Venkat
3 ACCEPTED SOLUTIONS

Accepted Solutions

DoTA
Honored Contributor

DBeaver does run metadata queries on its own. When you connect and expand the tree it lists catalogs, schemas, tables and columns, and each of those is a statement sent to the warehouse, so they show up in Query History even though you never typed anything. An open connection also keeps the warehouse from auto-stopping, and with a big metastore the introspection can be a lot of statements. If you filter Query History by your user you should see SHOW and information_schema style statements, which would confirm it.

On the DBeaver side, the Databricks driver page in their docs says metadata reads can cost compute and mentions a way to switch them off. I couldn't confirm the exact steps, so check that page. Adding a connection filter so the navigator only looks at the one catalog and schema you work in should also cut it down.

For the failed warehouse with EC2 still running: a Pro warehouse runs in your own AWS account, so those instances are yours and billed by AWS, which is why it matters. I don't know of a documented reason for a stop ending in Failed with instances left behind, so I wouldn't guess at the cause. I'd note the warehouse ID, look in the EC2 console to see whether the instances are still running and tagged with it, and open a support ticket with that ID and the time of the failure. Once support confirms they're orphaned you can terminate them by hand. In the meantime a short auto stop and a low max cluster count limit how much a stuck connection can spin up.

If you can paste a few Query History rows from a period where you weren't typing anything, it'll be easier to say what DBeaver is actually sending.

View solution in original post

balajij8
Esteemed Contributor II
DBeaver may do catalog and schema introspection along with metadata discovery queries at startup and its expected behavior. Establishing a JDBC/ODBC connection can auto start a stopped SQL warehouse, meaning connecting DBeaver alone is enough to trigger warehouse activity. To mitigate this on the client side in DBeaver, you can disable Connect on startup, avoid running full metadata refreshes, and only expand the specific schemas you need in the database navigator.
 
When it comes to warehouse overload, aggressive metadata discovery from JDBC and BI clients can drive up query volume and queueing. You should monitor the Peak Queued Queries metric and adjust the max clusters setting based on it. To isolate these requests, you can try adding query_tags directly to the DBeaver JDBC URL to identify DBeaver generated requests in the query history. You can setup a small, separate warehouse specifically to DBeaver so it cannot mix with the production workloads.

Regarding the SQL Pro Warehouse entering a Failed state during a start or stop operation, this is typically caused by a transient cloud-provider-side launch failure. You can confirm whether the failure is throwing a PERMISSION_DENIED error, which happens if the warehouse owner lacks cluster-creation entitlements (SQL warehouse launch fails due to PERMISSION_DENIED).

For the EC2 instance termination behavior when a warehouse fails or stops, stopping a warehouse is supposed to terminate its underlying EC2 instances promptly. You can verify the lifecycle timeline via the warehouse's Events tab- logs all start, stop and termination events and cross-check instance IDs in the AWS. If the EC2 instances persist well after the warehouse shows as stopped or failed, that is abnormal and you can open a Databricks support ticket with the workspace and warehouse IDs.

The best practice is to run the small dedicated warehouse for DBeaver with an auto-stop window of 15 - 30 minutes. Use serverless as it gives automatic resource management (BI workload) if feasible. You can also configure a warehouse-level statement timeout and include query_tags in the DBeaver JDBC URL to keep client traffic traceable.

View solution in original post

datarich
Databricks Employee
Databricks Employee

Hi Venkat, these are two separate issues.

1. DBeaver background queries Yes, this is expected. On connect, DBeaver reads metadata to fill the navigator, autocomplete and table info. It does this by running SHOW/DESCRIBE and information_schema queries. With a big Unity Catalog, that can mean a lot of queries. Keep-alive pings and idle JDBC sessions can also keep the warehouse awake even when you're not running anything.

To check what's being sent, open DBeaver's Query Manager with all query types shown. Then filter Databricks Query History by your user or client application.

To cut it down:

  • Preferences > Connections > Metadata: tick "Do not read tables information in SQL and data editors". You lose some autocomplete, but it stops most background reads.

  • SQL Editor > Code Editor: turn off "Read database table/column for semantic analysis".

  • Connection > Initialization: turn keep-alive off, or set it to a long interval.

  • Set a default catalog and schema in the JDBC URL with ConnCatalog and ConnSchema. Use navigator filters too, so DBeaver doesn't crawl every catalog.

  • Use the latest Databricks JDBC driver.

Heavy information_schema traffic can also get rate limited on the Unity Catalog side, which shows up as slow metadata queries or REQUEST_LIMIT_EXCEEDED. That's another reason to cut the metadata reads.

2. Warehouse failed and EC2 instances kept running Pro warehouses run their EC2 instances in your AWS account, so a failure here is usually caused by something on the AWS side. Common causes:

  • Missing permissions on the cross-account IAM role. If ec2:TerminateInstances is missing, Databricks can't clean up.

  • Subnets running out of IP addresses, or not enough EC2 capacity in the AZ.

  • An invalid instance profile in the SQL data access settings.

  • Someone editing or removing the Databricks tags on the instances.

To check what's still running:

  • In EC2, filter by the tag SqlEndpointId = <your warehouse ID>, or Vendor = Databricks.

  • Check the warehouse's monitoring tab, or system.compute.warehouse_events, for the failure reason.

  • If instances are still running well after the warehouse stopped, open a support ticket with the warehouse ID. Don't terminate them by hand until you know why.

Best practices

  • Consider a serverless warehouse for ad-hoc tools like DBeaver. It starts in seconds and stops quickly, and there are no EC2 instances in your account to manage.

  • Use a short auto stop, and a separate small warehouse for ad-hoc work.

  • Keep DBeaver's metadata reads limited as above.

Docs:

 

View solution in original post

3 REPLIES 3

DoTA
Honored Contributor

DBeaver does run metadata queries on its own. When you connect and expand the tree it lists catalogs, schemas, tables and columns, and each of those is a statement sent to the warehouse, so they show up in Query History even though you never typed anything. An open connection also keeps the warehouse from auto-stopping, and with a big metastore the introspection can be a lot of statements. If you filter Query History by your user you should see SHOW and information_schema style statements, which would confirm it.

On the DBeaver side, the Databricks driver page in their docs says metadata reads can cost compute and mentions a way to switch them off. I couldn't confirm the exact steps, so check that page. Adding a connection filter so the navigator only looks at the one catalog and schema you work in should also cut it down.

For the failed warehouse with EC2 still running: a Pro warehouse runs in your own AWS account, so those instances are yours and billed by AWS, which is why it matters. I don't know of a documented reason for a stop ending in Failed with instances left behind, so I wouldn't guess at the cause. I'd note the warehouse ID, look in the EC2 console to see whether the instances are still running and tagged with it, and open a support ticket with that ID and the time of the failure. Once support confirms they're orphaned you can terminate them by hand. In the meantime a short auto stop and a low max cluster count limit how much a stuck connection can spin up.

If you can paste a few Query History rows from a period where you weren't typing anything, it'll be easier to say what DBeaver is actually sending.

balajij8
Esteemed Contributor II
DBeaver may do catalog and schema introspection along with metadata discovery queries at startup and its expected behavior. Establishing a JDBC/ODBC connection can auto start a stopped SQL warehouse, meaning connecting DBeaver alone is enough to trigger warehouse activity. To mitigate this on the client side in DBeaver, you can disable Connect on startup, avoid running full metadata refreshes, and only expand the specific schemas you need in the database navigator.
 
When it comes to warehouse overload, aggressive metadata discovery from JDBC and BI clients can drive up query volume and queueing. You should monitor the Peak Queued Queries metric and adjust the max clusters setting based on it. To isolate these requests, you can try adding query_tags directly to the DBeaver JDBC URL to identify DBeaver generated requests in the query history. You can setup a small, separate warehouse specifically to DBeaver so it cannot mix with the production workloads.

Regarding the SQL Pro Warehouse entering a Failed state during a start or stop operation, this is typically caused by a transient cloud-provider-side launch failure. You can confirm whether the failure is throwing a PERMISSION_DENIED error, which happens if the warehouse owner lacks cluster-creation entitlements (SQL warehouse launch fails due to PERMISSION_DENIED).

For the EC2 instance termination behavior when a warehouse fails or stops, stopping a warehouse is supposed to terminate its underlying EC2 instances promptly. You can verify the lifecycle timeline via the warehouse's Events tab- logs all start, stop and termination events and cross-check instance IDs in the AWS. If the EC2 instances persist well after the warehouse shows as stopped or failed, that is abnormal and you can open a Databricks support ticket with the workspace and warehouse IDs.

The best practice is to run the small dedicated warehouse for DBeaver with an auto-stop window of 15 - 30 minutes. Use serverless as it gives automatic resource management (BI workload) if feasible. You can also configure a warehouse-level statement timeout and include query_tags in the DBeaver JDBC URL to keep client traffic traceable.

datarich
Databricks Employee
Databricks Employee

Hi Venkat, these are two separate issues.

1. DBeaver background queries Yes, this is expected. On connect, DBeaver reads metadata to fill the navigator, autocomplete and table info. It does this by running SHOW/DESCRIBE and information_schema queries. With a big Unity Catalog, that can mean a lot of queries. Keep-alive pings and idle JDBC sessions can also keep the warehouse awake even when you're not running anything.

To check what's being sent, open DBeaver's Query Manager with all query types shown. Then filter Databricks Query History by your user or client application.

To cut it down:

  • Preferences > Connections > Metadata: tick "Do not read tables information in SQL and data editors". You lose some autocomplete, but it stops most background reads.

  • SQL Editor > Code Editor: turn off "Read database table/column for semantic analysis".

  • Connection > Initialization: turn keep-alive off, or set it to a long interval.

  • Set a default catalog and schema in the JDBC URL with ConnCatalog and ConnSchema. Use navigator filters too, so DBeaver doesn't crawl every catalog.

  • Use the latest Databricks JDBC driver.

Heavy information_schema traffic can also get rate limited on the Unity Catalog side, which shows up as slow metadata queries or REQUEST_LIMIT_EXCEEDED. That's another reason to cut the metadata reads.

2. Warehouse failed and EC2 instances kept running Pro warehouses run their EC2 instances in your AWS account, so a failure here is usually caused by something on the AWS side. Common causes:

  • Missing permissions on the cross-account IAM role. If ec2:TerminateInstances is missing, Databricks can't clean up.

  • Subnets running out of IP addresses, or not enough EC2 capacity in the AZ.

  • An invalid instance profile in the SQL data access settings.

  • Someone editing or removing the Databricks tags on the instances.

To check what's still running:

  • In EC2, filter by the tag SqlEndpointId = <your warehouse ID>, or Vendor = Databricks.

  • Check the warehouse's monitoring tab, or system.compute.warehouse_events, for the failure reason.

  • If instances are still running well after the warehouse stopped, open a support ticket with the warehouse ID. Don't terminate them by hand until you know why.

Best practices

  • Consider a serverless warehouse for ad-hoc tools like DBeaver. It starts in seconds and stops quickly, and there are no EC2 instances in your account to manage.

  • Use a short auto stop, and a separate small warehouse for ad-hoc work.

  • Keep DBeaver's metadata reads limited as above.

Docs: