Oracle Sample / Capacity

Regarding this:

Selectivity is a value from 0 to 1, and this is the fraction of the rows returned after applying the filter to the table. For example, if the table has 10,000 rows and the query returns 2601 rows, the selectivity would be 2601/10000 or 0.26 or 26 percent. selectivity allows you (or the optimizer, for that matter) to decide which data access method is optimal in terms of execution.

I need some clarification: ok, this table has 10,000 rows and only 2601 is returned by the query. But what if this query block contains three joined tables or does it contain a subquery in the where clause? So there are three tables in the FROM clause, and the fourth table is part of the where where subquery, while this selectivity is calculated?

Selectivity = number of rows satisfying the condition (from which table?) / Total number of rows (from all four tables?)

The same issue for power (power = selectivity * total number of rows).

I found many articles about this, but each of them illustrates these concepts with simple select statements based on one table or one where where clause.

Can someone give me an example of how these measures are calculated in the case of a more complex query (in the "hr" scheme or in another target scheme), which means subqueries in the FROM clause or the WHERE clause, etc. on the?

Thank.

EDIT: , ( ). http://gerardnico.com/wiki/database/oracle/selectivity , (last_name = 'Smith') n last_name, , n .

, , " n ".

, 107 , : [ ] [/]

* , last_name = 'Smith'

2 , 2/107 = 0,01? , , / . , "".

, , ​​NDV ( , dba_tab_col_statistics)/ (http://www.runningoracle.com/product_info.php?products_id=233). , NDV 103, last_name 103/107 = 0,96.

... ? , , .

.

+4
1

, .

, , .

Oracle , . , . .

. Oracle , , . " ".

, .

, .

+3

Source: https://habr.com/ru/post/1530757/


All Articles