view very slow in sql2005

  • Create view X

    as

    SELECT

    xlsST_VCTTRANS_PCNL_Current.*

    FROM

    xlsST_VCTTRANS_PCNL_Current

    WHERE

    (

    CAST(TRANS_SRT AS VARCHAR) +

    LTRIM(RTRIM(TRANS_DAT)) +

    CAST(TRANS_NR AS VARCHAR) +

    CAST(VOLGNUMMER_EVENT AS VARCHAR)

    ) NOT IN

    (

    SELECT

    CAST(TRANS_SRT AS VARCHAR) +

    LTRIM(RTRIM(TRANS_DAT)) +

    CAST(TRANS_NR AS VARCHAR) +

    CAST(VOLGNUMMER_EVENT AS VARCHAR)

    FROM

    xlsST_VCTTRANS_PCNL_Prv1

    )

    A select from this view taks in sql2000 a view second

    but in sql2005 more then 60 minutes

    Please tel me what is wrong

  • First thing to check is whether the statistics are updated on your SQL Server 2005 machine.

    If they are OK, you should compare the execution plans on both servers (if you post them I'll have a look too).

    By looking at the view definition I also suspect that rewriting the query using an outer join or where (not) exists may have a dramatic impact on performance.

    Regards,

    Willem
    http://wschampheleer.wordpress.com[/url]

  • Based on the query, you're probably getting pretty severe table scans. But I agree with the previous post, make sure your statistics are up to date.

    Can you post the execution plan?

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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