{"id":1702,"date":"2011-11-20T07:23:30","date_gmt":"2011-11-20T12:23:30","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=1702"},"modified":"2011-11-28T21:16:53","modified_gmt":"2011-11-29T02:16:53","slug":"filter-and-access-in-explain-plan-output","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2011\/11\/20\/filter-and-access-in-explain-plan-output\/","title":{"rendered":"filter and access in explain plan output"},"content":{"rendered":"<p>I have found that there is often confusion on exactly what these mean.  The short answer is this:<\/p>\n<p>The access is the where clause used to locate the rows, which are then subject to further inclusion (filtering) by the another secondary column that wasn&#8217;t the main driver in finding rows.  I think the confusion arises from the fact &#8220;filter&#8221; can be a word used to restrict output, which is what a where clause does.  It also appears first in the output, which I think can also be confusing.<\/p>\n<p>Below shows a simple example.  There is a primary key on column C, and no index on column D.<\/p>\n<pre lang=\"sql\">\r\nSQL> begin\r\n  2    for i in 1..50000 loop\r\n  3      insert into t values(i,mod(i,2));\r\n  4    end loop;\r\n  5  end;\r\n  6  \/\r\n\r\nPL\/SQL procedure successfully completed.\r\n\r\nSQL> commit;\r\n\r\nCommit complete.\r\n\r\nSQL> explain plan for select * from t where c = 1000 and d = 0;\r\n\r\nExplained.\r\n\r\nSQL> select * from table(dbms_xplan.display());\r\n\r\nPLAN_TABLE_OUTPUT\r\n------------------------------------------------------------------------------------\r\nPlan hash value: 1303508680\r\n\r\n------------------------------------------------------------------------------------\r\n| Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     |\r\n------------------------------------------------------------------------------------\r\n|   0 | SELECT STATEMENT            |      |     1 |    26 |     1   (0)| 00:00:01 |\r\n|*  1 |  TABLE ACCESS BY INDEX ROWID| T    |     1 |    26 |     1   (0)| 00:00:01 |\r\n|*  2 |   INDEX UNIQUE SCAN         | T_PK |     1 |       |     0   (0)| 00:00:01 |\r\n------------------------------------------------------------------------------------\r\n\r\nPredicate Information (identified by operation id):\r\n   1 - filter(\"D\"=0)\r\n   2 - access(\"C\"=1000)\r\n\r\n15 rows selected.\r\n\r\nSQL>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have found that there is often confusion on exactly what these mean. The short answer is this: The access is the where clause used to locate the rows, which are then subject to further inclusion (filtering) by the another&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2011\/11\/20\/filter-and-access-in-explain-plan-output\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1702"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1702"}],"version-history":[{"count":12,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1702\/revisions"}],"predecessor-version":[{"id":1813,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/1702\/revisions\/1813"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1702"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}