{"id":1218,"date":"2020-12-03T17:06:59","date_gmt":"2020-12-03T09:06:59","guid":{"rendered":"http:\/\/www.821121.com\/?p=1218"},"modified":"2020-12-25T10:51:31","modified_gmt":"2020-12-25T02:51:31","slug":"12c%e6%96%b0%e7%89%b9%e6%80%a7%ef%bc%9ain-memory%e5%ae%9e%e6%88%98%ef%bc%882%ef%bc%89%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92%e7%9a%84%e4%b8%8d%e5%90%8c%e7%82%b9%e4%b8%8evim_segments","status":"publish","type":"post","link":"http:\/\/www.821121.com\/?p=1218","title":{"rendered":"12C\u65b0\u7279\u6027\uff1aIN-MEMORY\u5b9e\u6218\uff082\uff09\u6267\u884c\u8ba1\u5212\u7684\u4e0d\u540c\u70b9\u4e0ev$im_segments"},"content":{"rendered":"<p>\u67e5\u770binmemory\u7684\u8868\uff0c\u6267\u884c\u8ba1\u5212\u4e2d\u4f1a\u6709\u76f8\u5e94\u7684\u6807\u8bc6\u4f8b\u5982\u5168\u8868\u626b\u63cf\u4e3aTABLE ACCESS INMEMORY FULL\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-sql\">SQL&gt; create table test1 tablespace users as select * from dba_objects;\n\nTable created.\n\nSQL&gt; alter table test1 inmemory;\nSQL&gt; set autotrace on\nSQL&gt;  set autotrace traceonly\nSQL&gt; select count(*) from test1;\n\nExecution Plan\n----------------------------------------------------------\nPlan hash value: 3896847026\n\n-----------------------------------------------------------------------------\n| Id  | Operation                   | Name  | Rows  | Cost (%CPU)| Time     |\n-----------------------------------------------------------------------------\n|   0 | SELECT STATEMENT            |       |     1 |    15   (0)| 00:00:01 |\n|   1 |  SORT AGGREGATE             |       |     1 |            |          |\n|   2 |   TABLE ACCESS INMEMORY FULL| TEST1 | 72573 |    15   (0)| 00:00:01 |\n-----------------------------------------------------------------------------\n\nStatistics\n----------------------------------------------------------\n          0  recursive calls\n          0  db block gets\n          2  consistent gets\n          0  physical reads\n          0  redo size\n        552  bytes sent via SQL*Net to client\n        388  bytes received via SQL*Net from client\n          2  SQL*Net roundtrips to\/from client\n          0  sorts (memory)\n          0  sorts (disk)\n          1  rows processed<\/code><\/pre>\n<p>\u5728gv$im_segments\u4e2d\u53ef\u4ee5\u770b\u5230inmemory\u4f7f\u7528\u60c5\u51b5<\/p>\n<pre><code class=\"language-sql\">SQL&gt; col SEGMENT_NAME for a5\nSQL&gt; col POPULATE_STATUS for a10\nSQL&gt; col INMEMORY_DISTRIBUTE for a10\nSQL&gt; col INMEMORY_DUPLICATE for a20\nSQL&gt; set linesize 200\nSQL&gt; select INST_ID,SEGMENT_NAME,INMEMORY_SIZE\/1024\/1024,BYTES\/1024\/1024,BYTES_NOT_POPULATED\/1024\/1024,INMEMORY_DISTRIBUTE,INMEMORY_DUPLICATE,POPULATE_STATUS from gv$im_segments;\n\n   INST_ID SEGME INMEMORY_SIZE\/1024\/1024 BYTES\/1024\/1024 BYTES_NOT_POPULATED\/1024\/1024 INMEMORY_D INMEMORY_DUPLICATE   POPULATE_S\n---------- ----- ----------------------- --------------- ----------------------------- ---------- -------------------- ----------\n         1 TEST1                  4.4375       11.015625                             0 AUTO       NO DUPLICATE         COMPLETED<\/code><\/pre>\n<p><strong>INMEMORY_SIZE\uff1a<\/strong>segment\u5728in-memory\u4e2d\u5360\u7528\u7684\u5185\u5b58\u6570\u91cf\uff0c\u5355\u4f4dbytes<br \/>\n<strong>BYTES\uff1a<\/strong>\u5728\u5185\u5b58\u4e2d\u5c55\u793a\u7684segment\uff0c\u5bf9\u5e94\u7684\u78c1\u76d8\u4e0a\u6570\u636e\u91cf\uff08\u4e0d\u5305\u62ec\u5143\u6570\u636e\u5757\uff09\uff0c\u5355\u4f4dbytes<br \/>\n<strong>BYTES_NOT_POPULATED\uff1a<\/strong>\u78c1\u76d8\u7684segment\u4e2d\u672a\u586b\u5145\u5230\u5185\u5b58\u4e2d\u7684\u90e8\u5206\u7684\u5927\u5c0f\uff0c\u5355\u4f4dbytes\u3002<br \/>\n\u7ed3\u5408test1\u8868\u7684\u60c5\u51b5\u5c31\u662f\uff1a\u5728\u786c\u76d8\u4e0a\u4e3a11MB\u7684segment\uff0c\u5e26\u5165in-memory\u538b\u7f29\u540e\u5360\u7528\u5185\u5b58\u7684\u5927\u5c0f\u4e3a4.4MB\uff0c\u8be5test1\u8868\u7684\u6570\u636e\u8fd8\u67090MB\u6ca1\u5e26\u5165\u5230\u5185\u5b58\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770binmemory\u7684\u8868\uff0c\u6267\u884c\u8ba1\u5212\u4e2d\u4f1a\u6709\u76f8\u5e94\u7684\u6807\u8bc6<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,19],"tags":[],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-in-memory","category-oracle-12c"],"_links":{"self":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1218"}],"version-history":[{"count":4,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1218\/revisions"}],"predecessor-version":[{"id":1222,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1218\/revisions\/1222"}],"wp:attachment":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}