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 your check for a.FieldIDNumber = '1' should better be moved into WHERE clause:

    SELECT

    MySelectList

    FROM SourceTable a

    LEFT JOIN SourceTable a1

    ON a.CompanyIdentifier = a1.CompanyIdentifier

    AND a1.FieldIDNumber = '2'

    LEFT JOIN SourceTable a2

    ON

    a.CompanyIdentifier = a2.CompanyIdentifier

    AND a2.FieldIDNumber = '3'

    LEFT JOIN SourceTable a3

    ON

    a.CompanyIdentifier = a3.CompanyIdentifier

    AND a3.FieldIDNumber = '4'

    LEFT JOIN SourceTable a4

    ON

    a.CompanyIdentifier = a4.CompanyIdentifier

    AND a4.FieldIDNumber = '5'

    WHERE a.FieldIDNumber = '1'

    Looks like it is banking client data you are working with. Is your FieldIDNumber defined as varchar or int? If it's a numeric, then don't use quotes to avoid unnecessary data type conversion.

    And the last one about your CXPACKET waits. That shows that you have problem with parallelism. Try to add OPTION (MAXDOP 1) after WHERE clause and see if it makes it run faster.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]