Skip to Main Content
  • Questions
  • What is meant by gathering the stats on a table and how do we use them in the database

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, santhosh.

Asked: January 13, 2017 - 4:40 am UTC

Last updated: January 13, 2017 - 6:53 am UTC

Version: 11g

Viewed 10K+ times! This question is

You Asked

Hi Team,


I am a beginner for the PL/SQL i want to know what does the term "gathering of the stats on the table" what does it mean and how will it helps in the database and whats the use of gathering the stats on the respective tables.Can give me an example to get clear picture on gathering the stats.


Thank you,
santhosh.

and Connor said...

If I have to buy 2 things at the shop, I might walk there.
If I have to buy 10 things, I might walk there and take a bag with me.
If I have to buy 200 items...I'll probably drive my car.

Hence the *size* of a task, often determines *how* I will carry out that task.

The database is the same. It records information on the size of tables so it can best work out how to run queries. This information is called "statistics" and hence we "gather" those statistics using the DBMS_STATS package.

There's a whole section in the documentation about how it works and why you need stats

https://docs.oracle.com/database/121/TGSQL/tgsql_optcncpt.htm#TGSQL192

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thanks Connor

santhosh pogaku, January 13, 2017 - 4:22 pm UTC


A reader, March 14, 2023 - 6:34 am UTC


More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library