January 21, 2019 at 8:19 am
It might be worth trying to rewrite the query. The query below is equivalent to your query and will produce a different execution plan:
It would be good if you could have a clustered index on STATUS_ID, PROPERTY_ID, SOURCE_ID. To do this you would have to make the primary key nonclustered.
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000018
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000092
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000095
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000096
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000316
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000320
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000329
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000331
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000334
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000335
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000340
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000341
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000603
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000605
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000611
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000613
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000614
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000615
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000616
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000617
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000618
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000620
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000621
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000623
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000625
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000626
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000638
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000639
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000640
January 21, 2019 at 8:25 am
Jonathan AC Roberts - Monday, January 21, 2019 8:19 AMIt might be worth trying to rewrite the query. The query below is equivalent to your query and will produce a different execution plan:
It would be good it you could have a clustered index on STATUS_ID, PROPERTY_ID, SOURCE_ID. To do this you would have to make the primary key nonclustered.
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000018
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000092
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000095
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000096
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000316
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000320
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000329
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000331
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000334
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000335
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000340
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000341
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000603
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000605
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000611
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000613
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000614
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000615
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000616
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000617
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000618
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000620
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000621
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000623
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000625
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000626
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000638
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000639
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000640
thank you sir, I'll try out the query above and see how it works.
January 21, 2019 at 8:30 am
Tomys - Monday, January 21, 2019 8:25 AMJonathan AC Roberts - Monday, January 21, 2019 8:19 AMIt might be worth trying to rewrite the query. The query below is equivalent to your query and will produce a different execution plan:
It would be good it you could have a clustered index on STATUS_ID, PROPERTY_ID, SOURCE_ID. To do this you would have to make the primary key nonclustered.
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000018
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000092
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000095
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000096
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000316
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000320
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000329
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000331
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000334
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000335
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000340
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000341
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000603
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000605
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000611
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000613
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000614
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000615
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000616
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000617
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000618
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000620
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000621
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000623
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000625
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000626
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000638
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000639
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000640thank you sir, I'll try out the query above and see how it works.
Unfortunately I am getting error as :
Msg 4104, Level 16, State 1, Line 4
The multi-part identifier "o2a.PROPERTY_ID" could not be bound.
January 21, 2019 at 8:42 am
There query appears to be missing an alias:SELECT o2a.SOURCE_ID source_id, o2a.VALUE
FROM CR2Copy..OBJECT_TO_ATTRIBUTE
should beSELECT o2a.SOURCE_ID source_id, o2a.VALUE
FROM CR2Copy..OBJECT_TO_ATTRIBUTE AS o2a
January 21, 2019 at 9:09 am
pietlinden - Monday, January 21, 2019 8:42 AMThere query appears to be missing an alias:SELECT o2a.SOURCE_ID source_id, o2a.VALUE
FROM CR2Copy..OBJECT_TO_ATTRIBUTEshould be
SELECT o2a.SOURCE_ID source_id, o2a.VALUE
FROM CR2Copy..OBJECT_TO_ATTRIBUTE AS o2a
Yes, thanks, I've correct that below:SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000018
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000092
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000095
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000096
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000316
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000320
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000329
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000331
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000334
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000335
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000340
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000341
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000603
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000605
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000611
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000613
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000614
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000615
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000616
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000617
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000618
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000620
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000621
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000623
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000625
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000626
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000638
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000639
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000640
January 21, 2019 at 7:04 pm
Jonathan AC Roberts - Monday, January 21, 2019 9:09 AMpietlinden - Monday, January 21, 2019 8:42 AMThere query appears to be missing an alias:SELECT o2a.SOURCE_ID source_id, o2a.VALUE
FROM CR2Copy..OBJECT_TO_ATTRIBUTEshould be
SELECT o2a.SOURCE_ID source_id, o2a.VALUE
FROM CR2Copy..OBJECT_TO_ATTRIBUTE AS o2aYes, thanks, I've correct that below:
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000018
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000092
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000095
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000096
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000316
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000320
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000329
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000331
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000334
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000335
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000340
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000341
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000603
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000605
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000611
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000613
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000614
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000615
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000616
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000617
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000618
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000620
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000621
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000623
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000625
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000626
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000638
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000639
UNION
SELECT o2a.SOURCE_ID source_id, o2a.VALUE extdata
FROM CR2Copy..OBJECT_TO_ATTRIBUTE o2a
WHERE o2a.STATUS_ID = 33000000000001
AND o2a.PROPERTY_ID = 1000000060338
AND o2a.SOURCE_ID = 82000000000640
Thank you , I will also include with no lock and run and see
January 21, 2019 at 7:14 pm
did you try the index and the insert into a temp table as I suggested?
If so what were the results
January 21, 2019 at 7:47 pm
Dear sir I tried creating index and it was taking a lot of time so had to stop it. Not sure how long it would run since it is prod server didn’t want to take any risk( will this cause anything to other process? )Please advise what other options are there if any. Thanks
January 21, 2019 at 8:09 pm
Tomys - Monday, January 21, 2019 7:47 PMDear sir I tried creating index and it was taking a lot of time so had to stop it. Not sure how long it would run since it is prod server didn’t want to take any risk( will this cause anything to other process? )Please advise what other options are there if any. Thanks
If you have enterprise SQL Server you can use the ONLINE=ON option which should allow other processes to access the table while the index is being created.
January 22, 2019 at 12:04 am
Be REAL careful here. Changing the clustered index to having a such a low cardinality as well as being mutable is a recipe for disaster due to data movement. We are talking about a 2 billion row table here and as that Status_ID likely changes at least once, that's also going to cause massive page splits, massive fragmentation, and massive overuse of the log file. The last time I did such a thing on a table of that magnitude, I brought Expedia.com to its knees and that was just with a non-clustered index of similar ilk.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 22, 2019 at 4:35 am
Jonathan AC Roberts - Monday, January 21, 2019 8:19 AMIt would be good it you could have a clustered index on STATUS_ID, PROPERTY_ID, SOURCE_ID.
Be REAL careful here. Changing the clustered index to having a such a low cardinality as well as being mutable is a recipe for disaster due to data movement. We are talking about a 2 billion row table here and as that Status_ID likely changes at least once, that's also going to cause massive page splits, massive fragmentation, and massive overuse of the log file. The last time I did such a thing on a table of that magnitude, I brought Expedia.com to its knees and that was just with a non-clustered index of similar ilk.
Yes, good point.
January 22, 2019 at 8:56 am
Hello sir, thanks for your suggestion I will try out and be careful before doing it.
January 22, 2019 at 8:56 am
Okay thank you
January 22, 2019 at 9:23 am
Jonathan AC Roberts - Monday, January 21, 2019 8:19 AMIt would be good it you could have a clustered index on STATUS_ID, PROPERTY_ID, SOURCE_ID.
Be REAL careful here. Changing the clustered index to having a such a low cardinality as well as being mutable is a recipe for disaster due to data movement. We are talking about a 2 billion row table here and as that Status_ID likely changes at least once, that's also going to cause massive page splits, massive fragmentation, and massive overuse of the log file. The last time I did such a thing on a table of that magnitude, I brought Expedia.com to its knees and that was just with a non-clustered index of similar ilk.
Dear sir, I am not sure if this proper for the columns you mentioned , it shows me in the index key column list section for an index, please see my snip attached, but included columns list tab is empty.
January 22, 2019 at 9:50 am
Jeff Moden - Tuesday, January 22, 2019 12:04 AMJonathan AC Roberts - Monday, January 21, 2019 8:19 AMIt would be good it you could have a clustered index on STATUS_ID, PROPERTY_ID, SOURCE_ID.Be REAL careful here. Changing the clustered index to having a such a low cardinality as well as being mutable is a recipe for disaster due to data movement. We are talking about a 2 billion row table here and as that Status_ID likely changes at least once, that's also going to cause massive page splits, massive fragmentation, and massive overuse of the log file. The last time I did such a thing on a table of that magnitude, I brought Expedia.com to its knees and that was just with a non-clustered index of similar ilk.
Dear sir, I am not sure if this proper for the columns you mentioned , it shows me in the index key column list section for an index, please see my snip attached, but included columns list tab is empty.
I suggested you create a CLUSTERED index on those columns. This is probably not a good idea due to the fragmentation/splitting/update issues Jeff pointed out in his comment.
If you are going to create a non-clustered index then you would also need to have the Value column in the Included columns tabCREATE INDEX IX_OBJECT_TO_ATTRIBUTE_1
ON dbo.OBJECT_TO_ATTRIBUTE(STATUS_ID, PROPERTY_ID, SOURCE_ID) INCLUDE (Value)
If you create a clustered index you would just need to create it on the STATUS_ID, PROPERTY_ID, SOURCE_ID columns. Ideally starting with the most selective column as the leading column of the index. But as you can only have one clustered index on a table you would have to make the primary key nonclustered before you can create a clustered index.
Viewing 15 posts - 16 through 30 (of 55 total)
You must be logged in to reply to this topic. Login to reply