Parallel ????

  • Hi,

    There is a long query like this:

    SELECT Col1, Col2,..., Coln FROM Database1.DBO.Table WHERE ...

    UNION

    SELECT Col1, Col2,..., Coln FROM Database2.DBO.Table WHERE ...

    UNION

    SELECT Col1, Col2,..., Coln FROM Database3.DBO.Table WHERE ...

    UNION

    SELECT Col1, Col2,..., Coln FROM Database4.DBO.Table WHERE ...

    .......

    The query will go to almost 50 databases and UNION the results into a single table. It seems that the query searches each database one by one. From a given situation like this is there anyway to speed up the query? Can I tell it to run in parallel? How?

    Thanks a lot.

  • This was removed by the editor as SPAM

  • Is ur where clause sargable? I mean it uses indexed columns or uses non-indexed columns and is it using any function in where clause?

    U may gain some efficiency using indexes.

    U sure there are duplicate records in different databases u don't want more than once? If there are no duplicate records then use UNION ALL instead of union b/c by default selects distinct records.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply