Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pmscorca
Post Patron
Post Patron

Stressing the performance query againt one table on a warehouse

Hi,

on a warehouse I've one table with 33 columns, having some datetime columns, some varchar columns, some bit columns and some integer columns.

I need to stress the performance query on this single table: I've already tried to use some DATEDIFF functions, registering good query times, but I'd like to proof some queries more time intensive, considering that a warehouse is based on delta format.

Any suggests to me, please? Many thanks

1 ACCEPTED SOLUTION

Hi @pmscorca,

 

All the query examples that I gave can be executed with a single table. The Recursive Common Table Expression (CTE) example that I gave uses a recursive cte on the same table, it uses the same table twice.

 

About your first time execution, that is normal behaviour, as can be seen in this documentation: https://learn.microsoft.com/en-us/fabric/data-warehouse/guidelines-warehouse-performance#cold-run-co... 
"The first 1-3 executions of a query perform noticeably slower than subsequent executions."

View solution in original post

3 REPLIES 3
FabianSchut
Solution Sage
Solution Sage

Hi @pmscorca,

 

There are several SQL queries that you can use for stresstesting. You can think of:

Reporting Queries with Complex Aggregations

SELECT
CustomerID,
SUM(TotalAmount) AS TotalSpent,
COUNT(OrderID) AS NumberOfOrders,
AVG(TotalAmount) AS AverageOrderValue
FROM Orders
WHERE OrderDate BETWEEN '2023-01-01' AND '2023-12-31'
GROUP BY CustomerID
ORDER BY TotalSpent DESC;

Recursive Common Table Expression (CTE)
WITH RecursiveOrgChart AS (
SELECT EmployeeID, ManagerID, 1 AS Level
FROM Employees
WHERE ManagerID IS NULL

UNION ALL

SELECT e.EmployeeID, e.ManagerID, roc.Level + 1
FROM Employees e
INNER JOIN RecursiveOrgChart roc ON e.ManagerID = roc.EmployeeID
)
SELECT *
FROM RecursiveOrgChart
ORDER BY Level;

Window Functions over Large Data Sets
SELECT
EmployeeID,
Salary,
RANK() OVER (PARTITION BY DepartmentID ORDER BY Salary DESC) AS SalaryRank
FROM Employees
WHERE HireDate BETWEEN '2000-01-01' AND '2023-01-01';

Lag and Lead Functions
SELECT
StockID,
PriceDate,
ClosePrice,
LAG(ClosePrice, 1) OVER (PARTITION BY StockID ORDER BY PriceDate) AS PreviousClosePrice,
LEAD(ClosePrice, 1) OVER (PARTITION BY StockID ORDER BY PriceDate) AS NextClosePrice,
(ClosePrice - LAG(ClosePrice, 1) OVER (PARTITION BY StockID ORDER BY PriceDate)) AS PriceChange,
(LEAD(ClosePrice, 1) OVER (PARTITION BY StockID ORDER BY PriceDate) - ClosePrice) AS PredictedChange
FROM StockPrices
WHERE PriceDate BETWEEN '2023-01-01' AND '2023-12-31'
ORDER BY StockID, PriceDate;

Hi, thanks for your reply.

Saying again that I need to query only on a single table without joining with other tables,

I've noticed that sometimes when a query is executed for the first time, in a new SQL query window or in an idle existing SQL query windows, the query time is more high than the next runs: is it a normal behaviour? Why?

Thanks

 

Hi @pmscorca,

 

All the query examples that I gave can be executed with a single table. The Recursive Common Table Expression (CTE) example that I gave uses a recursive cte on the same table, it uses the same table twice.

 

About your first time execution, that is normal behaviour, as can be seen in this documentation: https://learn.microsoft.com/en-us/fabric/data-warehouse/guidelines-warehouse-performance#cold-run-co... 
"The first 1-3 executions of a query perform noticeably slower than subsequent executions."

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.