Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 919179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:29:58+00:00 2026-05-15T18:29:58+00:00

I have been reading for the last two days about indexes and how to

  • 0

I have been reading for the last two days about indexes and how to optimize a database.

Despite I have a clear idea on Indexes i don’t know yet how to practically optimize my database.

Could you suggest any tutorial or technique to optimize a database.

Please be specific as i have been reading lots of theory but no specific instruction up to now

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:29:59+00:00Added an answer on May 15, 2026 at 6:29 pm

    If it "aint" broken don’t fix it. Look for the slow areas of your application, find the offending queries and analyze those query plans and address the index issues if any. Don’t just start making changes in your system because you just learned something!

    further reading: Link

    try this query to find missing indexes:

    --based on http://stackoverflow.com/questions/1540192/searching-for-table-index-scans
    --this query will show cahced query plans that "SCAN", change comments for other things
    
    ;WITH XMLNAMESPACES(DEFAULT N'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
    , CachedPlans AS
    (SELECT
         RelOp.op.value(N'../../@NodeId', N'int') AS ParentOperationID
             ,RelOp.op.value(N'@NodeId', N'int') AS OperationID
             ,RelOp.op.value(N'@PhysicalOp', N'varchar(50)') AS PhysicalOperator
             ,RelOp.op.value(N'@LogicalOp', N'varchar(50)') AS LogicalOperator
             ,RelOp.op.value(N'@EstimatedTotalSubtreeCost ', N'float') AS EstimatedCost
             ,RelOp.op.value(N'@EstimateIO', N'float') AS EstimatedIO
             ,RelOp.op.value(N'@EstimateCPU', N'float') AS EstimatedCPU
             ,RelOp.op.value(N'@EstimateRows', N'float') AS EstimatedRows
             ,cp.plan_handle AS PlanHandle
             ,qp.query_plan AS QueryPlan
             ,st.TEXT AS QueryText
             ,cp.cacheobjtype AS CacheObjectType
             ,cp.objtype AS ObjectType
             ,cp.usecounts AS UseCounts
         FROM sys.dm_exec_cached_plans                            cp
             CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle)     st
             CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle)   qp
             CROSS APPLY qp.query_plan.nodes(N'//RelOp')          RelOp (op)
    )
    SELECT
        PlanHandle
            ,ParentOperationID
            ,OperationID
            ,PhysicalOperator
            ,LogicalOperator
            ,UseCounts
            ,CacheObjectType
            ,ObjectType
            ,EstimatedCost
            ,EstimatedIO
            ,EstimatedCPU
            ,EstimatedRows
            ,QueryText
        FROM CachedPlans
        WHERE CacheObjectType = N'Compiled Plan'
            AND PhysicalOperator IN ('nothing will ever match this one!'
                                    --,'Assert'                             
                                    --,'Bitmap'
                                    --,'Clustered Index Delete'
                                    --,'Clustered Index Insert'
                                    ,'Clustered Index Scan'
                                    --,'Clustered Index Seek'
                                    --,'Clustered Index Update'
                                    --,'Compute Scalar'
                                    --,'Concatenation'
                                    --,'Constant Scan'
                                    ,'Deleted Scan'
                                    --,'Filter'
                                    --,'Hash Match'
                                    ,'Index Scan'
                                    --,'Index Seek'
                                    --,'Index Spool'
                                    ,'Inserted Scan'
                                    --,'Merge Join'
                                    --,'Nested Loops'
                                    --,'Parallelism'
                                    ,'Parameter Table Scan'
                                    --,'RID Lookup'
                                    --,'Segment'
                                    --,'Sequence Project'
                                    --,'Sort'
                                    --,'Stream Aggregate'
                                    --,'Table Delete'
                                    --,'Table Insert'
                                    ,'Table Scan'
                                    --,'Table Spool'
                                    --,'Table Update'
                                    --,'Table-valued function'
                                    --,'Top'
                                    )
        
    

    or this one:

    SELECT TOP 50
        total_worker_time/execution_count AS Avg_CPU_Time
            ,execution_count
            ,total_elapsed_time/execution_count as AVG_Run_Time
            ,(SELECT
                  SUBSTRING(text,statement_start_offset/2,(CASE
                                                               WHEN statement_end_offset = -1 THEN LEN(CONVERT(nvarchar(max), text)) * 2 
                                                               ELSE statement_end_offset 
                                                           END -statement_start_offset)/2
                           ) FROM sys.dm_exec_sql_text(sql_handle)
             ) AS query_text 
    FROM sys.dm_exec_query_stats 
    ORDER BY 3 DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading about UnitOfWork pattern for last two days but didn't understand
for the last two days I've been searching and reading a lot about something
I have been reading over the last few days about assembly language, and the
I have been reading up and trying Git for the last few days and
I have been reading up on DDD a lot over the last few days
I have spent the last two days reading up on this and ultimately have
Have been reading about async and tasks and been attempting to convert the CopyFileEx
I have been reading about making ajax heavy applications more search engine friendly: https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
I have been reading conflicting information about the use of #define macros in iOS
I have been reading a lot about QR codes and how the code itself

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.