SQL Server Performance

Query slowing down

Discussion in 'SQL Server 2005 Performance Tuning for DBAs' started by DavidBytheway, Jun 23, 2006.

  1. DavidBytheway New Member

    A query I have (launched from Visual Studio 2005 VB.NET program)on a SQL 2005 database, runs very slowly. If I create a new database and restore it from the backup of the original it runs super-fast. (It always runs fast if launched from Server Management Studio oddly enough.)

    If I detach the original database and re-attach it, it runs fast too from the VB app.-- for a day or two. I have tested with no other users active on the database and tried a manual BACKUP viz:

    BACKUP DATABASE InvioProd
    TO InvioTestManualLogX
    DBCC SHRINKDATABASE (InvioProd,10)

    -- to no effect. Only detach/reattach appears to help.

    Getting frantic. Don't know where to look next.

    David Bytheway
  2. satya Moderator

    How about update statistics and table reindexing on a periodcal basis, as long as the database is optimized then you wouldn't worry like this. When you restore or attach the database the cache will be clean and execution plans will be recreated afresh.

    Refer to the KBA :
    http://support.microsoft.com/?id=298475
    http://support.microsoft.com/?id=224587
    .. to resolve the performance issues.

    (Please post the thread in relevant forums)

    Satya SKJ
    Microsoft SQL Server MVP
    Contributing Editor & Forums Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided �AS IS� with no rights for the sake of knowledge sharing.

Share This Page