Query Slowness

PC & Tech Category

In the DBA career the most prominent issue we will face is the issueYesterday this database Query is running fine. But today we have observed database query response time is very slow compare as yesterday” raised from Development Team / Client.

Here are few things you can do, to find the root cause of this issue and solve it.

Note: This article is for someone with basic to intermediateexperience and serves as a checklist for finding solution to SQL “Query Slowness” issue.

From the DBA point of view, the first action should be

1. Take explain plan for database query.

  • If you have any old (yesterday) explain plan for database query, compare both.
  • Which type of optimizer is used in query?
  • If tables go to full table scan check the index available or not.
  • If index is not available, Create the index & Compare the explain plan.
  • If index available Check why my index is not being used?
  • Check the Joins Method
  • Using HINT to force the optimizer.

2. Compare the table growth today & old one.

3. Check the statistics gathered for the table or not.

  • Yesterday the table contains only 1,00,000 records.Yesterday nightinserted large number of records. (Depend on business).
  • Large number of deletion occur in the table.( So fragmentation is there)
  • Now the table contains 10,00,000 records.So its takes more time to fetch the data generally.
  • Check when did the table is analyzed?
  • Suppose the tables were analyzed yesterday morning. But yesterday night large number records are inserted.So we need to analyze the corresponding objects.
  • If statistics is outdated, gather the new statistics using Analyze/DBMS package.

4. Check the connected sessions

  • Yesterday 25 Active Users only connected to database.Today 100 Active users connected. (Due to this PGA, SGA & I/O used large amount of resource are consumed)
  • Check the wait event.

5. Check the Physical reads / Logical reads.

6. Check the hit ratio. (Library cache, Data dictionary & Db Cache)

7. Ensure if any init parameter or memory structure changed.

8. Generated trace file for the particular query. (Using TKPROF)

9. OS level any background process taking more CPU utilization belongs to the database. (RMAN backup, EXP/IMP, DB Analyze job, Materialized view refresh job etc)

By performing the above actions one can find the root cause and solution for “Query Slowness” issue.

I Hope this article helped to you.Suggestions are welcome.

Tags:

Edward Ramamoorthy Avatar

Help Us Grow

If you like this post, please share it with your friends.

You are free to copy and redistribute this article in any medium or format, as long as you keep the links in the article or provide a link back to this page.

Subscribe to Newsletter




Privacy Settings

Privacy & Cookie Overview

Our website uses cookies to provide you with the best user experience possible. These cookies are stored in your browser and perform essential functions such as recognizing you when you return to our website, as well as helping us to understand which sections of the website you find most useful and engaging.

To learn more, you can read our Privacy & Cookie Policy or reach out through our Contact form.

Strictly Necessary Cookies

Strictly Necessary Cookies must always be enabled to ensure the proper functioning of this website and to allow us to provide you with excellent service. These cookies are also essential for saving your cookie preferences.

Google Adsense

We use Google AdSense to keep this site free by displaying relevant ads. AdSense requires essential cookies that cannot be disabled, but you can manage other cookies. We respect your privacy and provide options to control non-essential cookies.

For more details on how Google handles your data, visit Google's Data Usage Policy. Please review our Privacy Policy for more information on how we protect your data.

AddToAny

We use AddToAny for social sharing. It doesnโ€™t store cookies, ensuring a privacy-friendly experience. AddToAny complies with GDPR and CCPA by default.

For more, see their Privacy Policy.

OneSignal

We use OneSignal to send notifications to users who opt in. OneSignal complies with GDPR and is certified under the EU-US and Swiss-US Privacy Shield frameworks.

For more, see their Privacy Policy.

3rd Party Cookies

This website utilizes third-party cookies, which can enhance your experience and support our ongoing efforts to improve our services.

Google Analytics

We use Google Analytics to collect anonymous data, such as visitor numbers and popular pages, to improve user experience and site performance. Keeping this cookie enabled helps us refine the site based on visitor activity.

For more information, see Googleโ€™s Privacy Policy.

Discover more from Prime Inspiration

Subscribe now to keep reading and get access to the full archive.

Continue reading