I have a very simple query which I am running in Azure SQL Data Warehouse but it is taking around 40sec to execute.
Table definition:
CREATE TABLE dbo.orders
(
location_code VARCHAR(8) NOT NULL,
order_date DATETIME NOT NULL,
order_status_code INT NOT NULL,
order_type_code VARCHAR(1) NULL,
coupon_code VARCHAR(8) NULL,
coupon_amount MONEY NOT NULL,
subtotal MONEY NOT NULL,
total_amount MONEY NULL,
order_number INT NOT NULL,
customer_code INT NOT NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
the query is :
SELECT location_code,
order_date,
order_status_code,
order_type_code,
coupon_code,
coupon_amount,
subtotal,
total_amount,
order_number,
customer_code
FROM orders WITH (nolock)
WHERE order_date >= '2016-04-01'
AND order_date <= '2016-04-30'
AND order_status_code < 99
There are 13,083,667 records in the table. Could anybody help me in optimizing this. I have provided 100 DWU for this.
thanks in advance.