forked from docs/doc-exports
Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
59 lines
10 KiB
HTML
59 lines
10 KiB
HTML
<a name="mrs_01_24544"></a><a name="mrs_01_24544"></a>
|
|
|
|
<h1 class="topictitle1">Configuring Caching of Materialized Views</h1>
|
|
<div id="body32001227"><p id="mrs_01_24544__en-us_topic_0000001470000412_p154531821132414">After a materialized view is created for an SQL statement, the SQL statement is rewritten to be queried through the materialized view when the SQL statement is executed. If the rewrite cache function is enabled for materialized views, the rewritten SQL statements will be saved to the cache (a maximum of 10,000 records can be saved by default) after the SQL statement is executed for multiple times. When the SQL statement is executed within the cache validity period (24 hours by default), the system obtains the rewritten SQL statement from the cache instead of rewriting the SQL statement.</p>
|
|
<p id="mrs_01_24544__en-us_topic_0000001470000412_p167416152543">You can add user-defined parameters <strong id="mrs_01_24544__en-us_topic_0000001470000412_b52893591571">rewrite.cache.timeout</strong> and <strong id="mrs_01_24544__en-us_topic_0000001470000412_b18435132484">rewrite.cache.limit</strong> to a compute instance to set the cache validity period and the maximum number of rewritten SQL statements that can be saved.</p>
|
|
<ul id="mrs_01_24544__en-us_topic_0000001470000412_ul18297205831516"><li id="mrs_01_24544__en-us_topic_0000001470000412_li9297258171516">When a new materialized view is created or an existing materialized view is deleted, the cache becomes invalid.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li16522921718">If the materialized view associated with a rewritten SQL query in the cache becomes invalid or is in the <strong id="mrs_01_24544__en-us_topic_0000001470000412_b1996331211569">Refreshing</strong> status, the rewritten SQL query will not be used.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li9317726132010">When the cache is used, the executed SQL query cannot be changed. Otherwise, it will be treated as a new SQL query.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li1979081111515">A maximum of 500 materialized views can be rewritten for SQL queries. That is, if the materialized views used during SQL rewriting are included in the 500 materialized views, the views will be rewritten. Otherwise, the views will be executed as common SQL statements. You can refer to <a href="#mrs_01_24544__en-us_topic_0000001470000412_li2891647173015">System level</a> to add user-defined parameter <strong id="mrs_01_24544__en-us_topic_0000001470000412_b1411412231011">hetu.select.top.materialized.view</strong> to compute instances to change the number of materialized views that can be used.</li></ul>
|
|
<div class="section" id="mrs_01_24544__en-us_topic_0000001470000412_section1177014151546"><h4 class="sectiontitle">Enabling Rewrite Cache for Materialized Views</h4><ul id="mrs_01_24544__en-us_topic_0000001470000412_ul48917473308"><li id="mrs_01_24544__en-us_topic_0000001470000412_li289147133015">Session level:<p id="mrs_01_24544__en-us_topic_0000001470000412_p48917473308"><a name="mrs_01_24544__en-us_topic_0000001470000412_li289147133015"></a><a name="en-us_topic_0000001470000412_li289147133015"></a>Run the <strong id="mrs_01_24544__en-us_topic_0000001470000412_b17975122512525">set session rewrite_cache_enabled=true</strong> command on the <span id="mrs_01_24544__en-us_topic_0000001470000412_text789174743019">HetuEngine</span> client by referring to <a href="mrs_01_1737.html">Using the HetuEngine Client</a>.</p>
|
|
</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li2891647173015"><a name="mrs_01_24544__en-us_topic_0000001470000412_li2891647173015"></a><a name="en-us_topic_0000001470000412_li2891647173015"></a>Enabling the materialized view rewriting capability at the system level:<ol id="mrs_01_24544__en-us_topic_0000001470000412_ol489164712309"><li id="mrs_01_24544__en-us_topic_0000001470000412_li178924711300">Log in to FusionInsight Manager as a user who can access the <span id="mrs_01_24544__en-us_topic_0000001470000412_text4891047153015">HetuEngine</span> web UI.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li118974713011">Choose <strong id="mrs_01_24544__en-us_topic_0000001470000412_b4689998350257">Cluster</strong> > <strong id="mrs_01_24544__en-us_topic_0000001470000412_b10542483000257">Services</strong> > <strong id="mrs_01_24544__en-us_topic_0000001470000412_b8362772980257"><span id="mrs_01_24544__en-us_topic_0000001470000412_text988606840257">HetuEngine</span></strong> to go its service page.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li1889947163015">In the <strong id="mrs_01_24544__en-us_topic_0000001470000412_b18372581170257">Basic Information</strong> area on the <strong id="mrs_01_24544__en-us_topic_0000001470000412_b18014914180257">Dashboard</strong> page, click the link next to <strong id="mrs_01_24544__en-us_topic_0000001470000412_b6123560880257">HSConsole WebUI</strong>. The HSConsole page is displayed.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li148924718308">Check whether the status of the instance to be operated is <strong id="mrs_01_24544__en-us_topic_0000001470000412_b323309720257">STOPPED</strong>. If not, change the status to <strong id="mrs_01_24544__en-us_topic_0000001470000412_b13578370860257">STOPPED</strong>.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li889747193014">Locate the row that contains the target instance, click <strong id="mrs_01_24544__en-us_topic_0000001470000412_b4234098180257">Configure</strong> in the <strong id="mrs_01_24544__en-us_topic_0000001470000412_b19352813670257">Operation</strong> column, and add the following customized parameters:
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_24544__en-us_topic_0000001470000412_table18899472307" frame="border" border="1" rules="all"><thead align="left"><tr id="mrs_01_24544__en-us_topic_0000001470000412_row1689164718305"><th align="left" class="cellrowborder" valign="top" width="20.95%" id="mcps1.3.4.2.2.1.5.3.1.5.1.1"><p id="mrs_01_24544__en-us_topic_0000001470000412_p789104713013">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="12.9%" id="mcps1.3.4.2.2.1.5.3.1.5.1.2"><p id="mrs_01_24544__en-us_topic_0000001470000412_p3899472309">Value</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.88%" id="mcps1.3.4.2.2.1.5.3.1.5.1.3"><p id="mrs_01_24544__en-us_topic_0000001470000412_p8891147193018">Parameter File</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="48.27%" id="mcps1.3.4.2.2.1.5.3.1.5.1.4"><p id="mrs_01_24544__en-us_topic_0000001470000412_p11194652436">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_01_24544__en-us_topic_0000001470000412_row1289134714304"><td class="cellrowborder" valign="top" width="20.95%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.1 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p11899477308">rewrite.cache.enabled</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.9%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.2 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p5894472306">true</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.88%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.3 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p989947103019">coordinator.config.properties</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.27%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.4 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p1719405218317">Enable the rewrite cache function for materialized views.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_24544__en-us_topic_0000001470000412_row124501843839"><td class="cellrowborder" valign="top" width="20.95%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.1 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p666661346">rewrite.cache.timeout</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.9%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.2 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p16661111445">86400000</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.88%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.3 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p12666417418">coordinator.config.properties</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.27%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.4 "><ul id="mrs_01_24544__en-us_topic_0000001470000412_ul1248223719414"><li id="mrs_01_24544__en-us_topic_0000001470000412_li14821637144118">Change the validity period of the rewrite cache.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li14482183717414">If this parameter is left blank, <strong id="mrs_01_24544__en-us_topic_0000001470000412_b1948220432591">86400000</strong> is used by default. The unit is ms.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_24544__en-us_topic_0000001470000412_row15450143636"><td class="cellrowborder" valign="top" width="20.95%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.1 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p466691446">rewrite.cache.limit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.9%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.2 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p4666511442">10000</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.88%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.3 "><p id="mrs_01_24544__en-us_topic_0000001470000412_p1666651449">coordinator.config.properties</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.27%" headers="mcps1.3.4.2.2.1.5.3.1.5.1.4 "><ul id="mrs_01_24544__en-us_topic_0000001470000412_ul162014144120"><li id="mrs_01_24544__en-us_topic_0000001470000412_li1162034119413">Modify the upper limit of the rewrite cache.</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li56204412419">If this parameter is left blank, <strong id="mrs_01_24544__en-us_topic_0000001470000412_b166061244107">10000</strong> is used by default.</li></ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="mrs_01_24544__en-us_topic_0000001470000412_li1478011145418">After the parameters are added, select <strong id="mrs_01_24544__en-us_topic_0000001470000412_b9677133595310">Start Now</strong> and click <strong id="mrs_01_24544__en-us_topic_0000001470000412_b1467843516537">OK</strong>.</li></ol>
|
|
</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_24533.html">Using HetuEngine Materialized Views</a></div>
|
|
</div>
|
|
</div>
|
|
|