Viewing 15 posts - 3,001 through 3,015 (of 7,614 total)
January 23, 2019 at 8:18 am
EXEC sp_MSforeachdb '
IF LEN(''?'') = 9 AND RIGHT(''?'', 5) = ''_prod''
BEGIN
USE [?];
IF EXISTS(SELECT 1 FROM sys.columns WHERE object_id =...
January 23, 2019 at 6:59 am
You need to either:
Cluster the table by timestamp (if that's how you (almost) always query against the table)
Or
Create a non-clus index on (Timestamp) include (TagName, Value)
January 22, 2019 at 10:42 am
You wouldn't typically want to cluster on status, since it tends to change.
However, you'd almost certainly be better off clustering by PROPERTY_ID and /or SOURCE_ID in whatever order. But...
January 22, 2019 at 10:02 am
Quite right on the "out of memory" error.
Overall, though, for best performance with far fewer total indexes:
cluster the CHUB_S_CON_ADDR TABLE on ( CONTACT_ID, ROW_ID ).
Add a...
January 18, 2019 at 12:53 pm
No need to use resources to recompute the string every time.
Pre-generate all the strings and store them in a permanent table. Then just pull out the row(s) you...
January 18, 2019 at 12:44 pm
January 15, 2019 at 2:02 pm
Agree, a filtered index if possible.
Then lock down the requirements. If you need to delete all B = 1, whether the date is a future date or not...
January 15, 2019 at 1:02 pm
It's usually more efficient to use MAX(), particularly for char columns. GROUP BY for an extra char column requires sorting/hashing that is typically much more overhead.
January 15, 2019 at 1:00 pm
A CROSS JOIN is good for this:
SELECT o.OrderID, o.OrderPaid, o.TotalTaxes, o.OrderTotal,
cy.CycleStartPlusOne, cy.CycleEndPlusOne
FROM dbo.Orders o
CROSS JOIN (
SELECT...
January 15, 2019 at 12:57 pm
Your ranges have gaps: where would 500,000.50 fall?
At any rate, something like:
SELECT s.sales, ss.Nota
FROM sales s
LEFT OUTER JOIN sales_setup ss ON s.sales...
January 10, 2019 at 3:05 pm
Don't use that view; because:
(1) it only returns 4000 chars, no matter how long the actual proc is.
(2) INFORMATION_SCHEMA views run slowly and generate overhead that's not needed.
January 10, 2019 at 10:44 am
Viewing 15 posts - 3,001 through 3,015 (of 7,614 total)