I'm running a query in Synapse using the following tables: sys.query_store_plan
, sys.query_store_query
, and sys.query_store_query_text
. This query executes successfully on SQL Server version 12.00.2531 with only the VIEW DEFINITION
permission granted to the user via:
GRANT VIEW DEFINITION ON DATABASE::<database_name> TO <username>;
I am using the same exact query mentioned in the docs:
https://video2.skills-academy.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store?view=azuresqldb-current&preserve-view=true
SELECT Txt.query_text_id, Txt.query_sql_text, Pln.plan_id, Qry.*, RtSt.*
FROM sys.query_store_plan AS Pln
INNER JOIN sys.query_store_query AS Qry
ON Pln.query_id = Qry.query_id
INNER JOIN sys.query_store_query_text AS Txt
ON Qry.query_text_id = Txt.query_text_id
INNER JOIN sys.query_store_runtime_stats RtSt
ON Pln.plan_id = RtSt.plan_id;
However, when running the same query on synapse that is using SQL Server version 12.00.5624 with VIEW DEFINITION
permission granted already, it fails with the following error:
2024-09-01 11:03:20.656 [main] ERROR c.Logging$GlobalExceptionHandler - Uncaught exception in thread 'main': 'com.microsoft.sqlserver.jdbc.SQLServerException: VIEW DATABASE PERFORMANCE STATE permission denied in database 'test'
This permission is required to access the DMVs but we are not accessing DMVs here. The above tables mentioned
What could be the cause of this discrepancy in required permissions between the two SQL Server versions?