Home Forums SQL Server 2008 T-SQL (SS2K8) Query seems to be constrained by single core CPU in multiple core server - any suggestions? RE: Query seems to be constrained by single core CPU in multiple core server - any suggestions?

  • First of all you need to make sure the Sourcetable (a1, a2,a3,a4,a5) have clustered index on (CompanyIdentifier,FieldIDNumber)

    Second, if I understand correctly those joined tables are actually the same one joined multiple times to itself. Then you better join it once and put all FieldID's into a single IN condition.

    Then you may put the returned values into different columns in SELECT part using cross-tab (pivot) kind of query.

    Third - the table "a" must be a derived table with grouping by CustomerIdentifier inside, so it returns a single record per Customer.

    And the last.

    It's just my speculation because I did not the the actual query, but I recon you do not need those joins at all.

    One simple cross-tab query (considering you've got that clustered index in place) will do the job easily and quickly.

    You may find good examples for such queries in BOL or on this site.

    _____________
    Code for TallyGenerator