How did the same predicate is completed access and filter?

SELECT select, j.job_title, d.department_name

OF e hr.employees, hr.departments d, hr.jobs j

WHERE e.department_id = d.department_id

AND e.job_id = j.job_id

AND select LIKE 'a % ';

Execution plan

----------------------------------------------------------

Hash value of plan: 975837011

---------------------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

---------------------------------------------------------------------------------------------

| 0 | SELECT STATEMENT | 3. 189. 7 (15) | 00:00:01 |

|* 1 | HASH JOIN | 3. 189. 7 (15) | 00:00:01 |

|* 2 | HASH JOIN | 3. 141. 5 (20) | 00:00:01 |

| 3. TABLE ACCESS BY INDEX ROWID | EMPLOYEES | 3. 60. 2 (0) | 00:00:01 |

|* 4 | INDEX RANGE SCAN | EMP_NAME_IX | 3 | | 1 (0) | 00:00:01 |

| 5. TABLE ACCESS FULL | JOBS | 19. 513. 2 (0) | 00:00:01 |

| 6. TABLE ACCESS FULL | DEPARTMENTS | 27. 432. 2 (0) | 00:00:01 |

---------------------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - access("E".") DEPARTMENT_ID "=" D ". ("" DEPARTMENT_ID ")

2 - access("E".") JOB_ID '=' J '. ("' JOB_ID ')

4 - access ("E". "Last_name" LIKE 'A %') "

filter ("E". "LAST_NAME" LIKE 'A %') "

I understand not only how to select column is evaluated by the access and filter? Can someone there explain please? Or recommend me an article or document that explain this predicate excatly explains to explain the plan?

Thanks in advance.

Near NightWing.

I believe that the predicate can be used to access THE index entries and if entries of access could include potentially "false positives" then filtering is required to remove the FPs.

This filtering can be done in the same step of the operation (such as access) or as an extra step.

My apologies, this has become much longer and more detailed that I intended it to be. :-(

If I understand correctly,

In terms of the explanation of the path, each step can include access and filtering process for "entries" (index or line). In the plan to explain the predicate section shows Information the use of predicate for step 'matching. "

Some predicates can be "used" to ACCESS (ing) the entries, while the same or additional predicates (or even other) can be "used" to FILTER (ing) access entries (which have been consulted, but the optimizer is not sure that EACH AACCESSed entry is indeed a part of final result set). In such cases optimizer applies filtering predicate also during the operation stage. The optimizer can sometime even add additional operation steps or predicate [almost like a short circuit]

So, using our previous configuration, allow us to run test cases.

In this query we use AS predicate but the operand does NOT contain any 'wild' character In this case INDEX RANGE SCAN is performed, but since there is no wild characters are involved we can be sure that each entry using this predicate is indeed part of the final result set. This predicate Section shows that the predicate is used ONLY to access (index) entries.

We know that the result set of this query is NULL lines.

> explain plan for select v1 of tst where v1 as "A".

------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |     1.     7.     1 (0) | 00:00:01 |

|*  1 |  INDEX RANGE SCAN | TSTV1_IDX |     1.     7.     1 (0) | 00:00:01 |

------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - access ("V1" = 'A')

However, in this application, there is a wildcard character in the predicate, so while the INDEX RANGE SCAN step access entries using this predicate, it could potentially access entries that can be part of the final result set. So in the SAME step of the INDEX RANGE SCAN operation the predicate is also used for filtering. Since this is the only predicate, it may seem redundant.

> explain plan for select v1 of tst where v1 like 'a % '.

------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |    24.   168.     1 (0) | 00:00:01 |

|*  1 |  INDEX RANGE SCAN | TSTV1_IDX |    24.   168.     1 (0) | 00:00:01 |

------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - access ("V1" LIKE 'A %')

filter ("V1" LIKE 'A %')

If we add an another predicate as below (also includes wild character), it gets interesting. INDEX RANGE SCAN step performs two access AND filtering.

Please note that the predicate 'V1' AS '%' is used to ACCESS and FILTER, fine FILTER uses additional predicates.

> explain plan for select v1 of tst where v1 like 'A %' and v1 as "%c".

------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |     1.     7.     1 (0) | 00:00:01 |

|*  1 |  INDEX RANGE SCAN | TSTV1_IDX |     1.     7.     1 (0) | 00:00:01 |

------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - access ("V1" LIKE 'A %')

filter ("V1" IS NOT NULL AND "V1" LIKE 'A %') AND "V1" LIKE "%c"

When we change the predicate 'V1' LIKE 'A %' to 'V1' > 'A', then we can use the predicate to access entries AND do not forget that each entry using this predicate are

Indeed part of results if other predicates are met. In this case optimizer of must not filter on 'V1' > 'A', wherever it must continue to filter on 'V1' LIKE '%c '.

> explain plan for select v1 of tst where v1 > 'A' and v1 as "%c".

------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |     1.     7.     1 (0) | 00:00:01 |

|*  1 |  INDEX RANGE SCAN | TSTV1_IDX |     1.     7.     1 (0) | 00:00:01 |

------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - access("V1">'A')

filter ("V1" IS NOT NULL AND "V1" LIKE "%c")

Of course, if we do the predicate so that the entries are NOT accessible using the predicate, then for INDEX FULL SCAN (no Beach cannot be determined) operation comes into play and the predicate of ACCESS goes. All entries in the index are ALWAYS accessible (predicate applied no ACCESS) and FILTER predicate is applied.

> explain plan for select v1 of tst where v1 like '%c %'

------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |     1.     8 S     1 (0) | 00:00:01 |

|*  1 |  INDEX SCAN FULL | TSTV1_IDX |     1.     8 S     1 (0) | 00:00:01 |

------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - filter ("V1" IS NOT NULL AND "V1" LIKE '%A%c')

For the example proposed by JL, two predicates are used in the INDEX RANGE SCAN step to access THE entries. In addition, we can be sure that all entries that are accessible with success using this predicate can be included in the final result set. So not necessary filtering.

> explain plan for select v1 of tst where v1 > 'A' and v1<>

------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |    24.   168.     1 (0) | 00:00:01 |

|*  1 |  INDEX RANGE SCAN | TSTV1_IDX |    24.   168.     1 (0) | 00:00:01 |

------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - access("V1">'A' AND "V1")<>

Interestingly, when we change the 'B' in the previous query to 'A', change predicates of inequality, so we cannot use index. Optimizer knows this and switches for FTS and introduced an additional step of operation FILTER. In my view, the filter predicate can be applied in operation of FTS. Additional FILTER stage is the predicate as FALSE hard-coded value. It does not yet use our predicate of the query.

Well, don't know if he actually bypasses the operation of FTS. SQL trace can indicate that.

> explain plan for select v1 of tst where v1 > 'A' and v1<>

---------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

---------------------------------------------------------------------------

|   0 | SELECT STATEMENT |      |     1.     8 S     0 (0) |          |

|*  1 |  FILTER |      |       |       |            |          |

|   2.   TABLE ACCESS FULL | TST |    49.   343.     3 (0) | 00:00:01 |

---------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - filter (NULL IS NOT NULL AND NULL IS NOT NULL)

Subsequently, optimizer decides to use the INDEX RANGE SCAN, even if the predicate is always an inequality. Go figure...

> explain plan for select v1 of tst where v1 > 'A' and v1<=>

-------------------------------------------------------------------------------

| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

-------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |           |     1.     8 S     0 (0) |          |

|*  1 |  FILTER |           |       |       |            |          |

|*  2 |   INDEX RANGE SCAN | TSTV1_IDX |     1.     8 S     0 (0) | 00:00:01 |

-------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

1 - filter (NULL IS NOT NULL)

2 - access("V1">'A' AND "V1")<>

As others have said, it is difficult to understand and predict the path, but fortunately Oracle doing the right thing, 99% of the time.

VR

Sudhakar

Tags: Database

Similar Questions

Maybe you are looking for

  • How to export records of individual bookmarks?

    In early versions of Firefox there that a practice Add On named Synchonizer bookmarks, including the latest version has been updated by Torisugari. This enabled on individual files be exported and imported. Ideal for sharing information between colle

  • How to disable the start on Satelite P200-1E9 menu?

    Satellite P200-1E9... every time I turn on the phone it displays "enter the bootmenu" and I have to select a boot device. There is no way to disable the boot menu.BIOS is 2.70. I can t find an option to turn off the bootmenu. How can I solve this? Gr

  • Upgrading ram on dv9420ca

    Hi, I was wondering something.  I know that it is the States that up to 2 GB of ram is supported on the dv9420ca, if I put 4 GB of ram in my computer, will I run into problems running my PC?

  • CLIQ: MotoBLUR Happenings Widget to 'Hide' some friends Facebook status messages

    Facebook friends that I set to "Hide" in my stream will always appear in the events. Thank you Spencer Dahl

  • Starting test FAILED - HP ENVY 1191-NR

    Hey guys/girls, New to the forum - need some tech support.  I have a HP ENVY3D 1191-NR running Windows 7.  He recently began closing before you start completely.  I ran a Test at startup and for the following results: Memory test: FAILED FAILURE ID: