Query issue

  • Hi,

    I have this query:

    (select rgc, nif_gerente, nome, morada from SGCTCentralReplica.dbo.V_SMPN_gerentes with (nolock)

    where RGC in (select rgc from contribuintes)

    AND RGC NOT IN (SELECT rgc from tabelargc ) )

    It takes to long to run.

    How can i optimaze it?

    Thank you.

  • Please post the actual execution plan along with table DDL.

    Assuming that's all there is to it I'm not seeing much hope for massive improvements.

    Edit : And how long is way too long in your world, what's the target speed?

  • Please see this article

    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    For how to help us to help you



    Clear Sky SQL
    My Blog[/url]

  • Is V_SMPN_gerentes a view? If so, please post the view defintion, too.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 4 posts - 1 through 4 (of 4 total)

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