Files
doc-exports/docs/dws/tool/DWS_DS_120.html
Lu, Huayi 4194b50d78 DWS TOOL 811 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2022-12-14 20:46:26 +00:00

64 lines
18 KiB
HTML

<a name="EN-US_TOPIC_0000001145833043"></a><a name="EN-US_TOPIC_0000001145833043"></a>
<h1 class="topictitle1">Managing the History of Executed SQL Queries</h1>
<div id="body1584526252529"><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p35191048">Data Studio allows viewing and managing frequently executed SQL queries. The history of executed SQL queries is saved only in <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b2905617223547">SQL Terminal</strong>.</p>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p48283984">Perform the following steps to view the history of executed SQL queries:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol320174758"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li16362779511"><span>Click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image474692011513" src="figure/en-us_image_0000001099153360.jpg" height="26.9325" width="27.93" title="Click to enlarge" class="imgResize"></span> in <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b15746122014518">SQL Terminal</strong>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p26051381851">The <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b1257314181859">SQL History</strong> dialog box is displayed.</p>
</p></li></ol>
<div class="note" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_note33979931"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p39948792">The scripts of historical SQL queries are not encrypted.</p>
</div></div>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p37383929">The number of queries displayed in the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b460030520475">SQL History</strong> dialog box depends on the value set in <strong id="EN-US_TOPIC_0000001145833043__b1952954512720">Preferences</strong> &gt; <strong id="EN-US_TOPIC_0000001145833043__b391813483715">Editor</strong> &gt; <strong id="EN-US_TOPIC_0000001145833043__b12511526713">SQL History</strong>. For details about setting the value, see <a href="DWS_DS_138.html#EN-US_TOPIC_0000001145913107__en-us_topic_0185264581_section1382623812471">SQL History</a>. Data Studio overwrites the older queries into the SQL history after the list is full. The executed queries are automatically stored in the list.</p>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p32432801134124">The <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b3867312518611">SQL History</strong> dialog box contains the following columns:</p>
<ul id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ul911047"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li43916760"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b4586012918114">Pin Status</strong>: displays whether a query remains on the top. Pinned queries remain on the top and will not be deleted from the history even when the list is full.</li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li487831"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b21932360181111">SQL Statement</strong>: displays the SQL query. The maximum number of characters for a SQL query displayed in the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b1570817018853">SQL Statement</strong> column depends on the value set in <strong id="EN-US_TOPIC_0000001145833043__b1819532219392">Preferences</strong> &gt; <strong id="EN-US_TOPIC_0000001145833043__b7195112263917">Editor</strong> &gt; <strong id="EN-US_TOPIC_0000001145833043__b121951422113917">SQL History</strong>. For details about modifying the value, see <a href="DWS_DS_138.html#EN-US_TOPIC_0000001145913107__en-us_topic_0185264581_section1382623812471">SQL History</a>.</li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li39514346"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b41299017181117">Number of Records</strong>: displays the number of records obtained by the SQL query</li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li46545466"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b13184781181324">Start Time</strong>: displays the time when the query was executed</li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li12086382"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b57484040181330">Execution Time</strong>: displays the duration of the query execution</li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li39472879"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b2552962181616">Database Name</strong>: displays the name of the database</li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li43186596"><strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b4091068181338">Execution Status</strong>: displays the status of the executed query, which can be <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b42517832181021">Success</strong> or <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b21392392181021">Failure</strong></li></ul>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p8199431">The connection information is deleted together with the query history. If the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b611426323023">SQL History</strong> dialog box is closed, the query is not removed from the list.</p>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p4696429">You can perform the following operations in the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b467110890557">SQL History</strong> dialog box:</p>
<ul id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ul42267867"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li619814411328"><a href="#EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ref471314809">Loading a SQL Query into the SQL Terminal Pane</a></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li4297671511342"><a href="#EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section29561677225829">Loading Multiple SQL Queries into the SQL Terminal Pane</a></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li587321941141"><a href="#EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section41363205225852">Deleting a SQL Query</a></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li1734002611414"><a href="#EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section3787436422590">Deleting All SQL Queries</a></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li4695545211423"><a href="#EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ref471314785">Pinning a SQL Query</a></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li6023740211431"><a href="#EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section62690964225923">Unpinning a SQL Query</a></li></ul>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ref471314809"><a name="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ref471314809"></a><a name="en-us_topic_0185264358_ref471314809"></a><h4 class="sectiontitle">Loading a SQL Query into the SQL Terminal Pane</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p29602433">Perform the following steps to load a SQL query into the <strong id="EN-US_TOPIC_0000001145833043__b1565962210489">SQL Terminal</strong> pane:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol48986840"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li38228382"><span>Select the required query and click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image8511124" src="figure/en-us_image_0000001099153248.jpg" width="19.950000000000003" height="23.94" title="Click to enlarge" class="imgResize"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p9491260">The query is added to the cursor position in <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b2309203604341">SQL Terminal</strong>.</p>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section29561677225829"><a name="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section29561677225829"></a><a name="en-us_topic_0185264358_section29561677225829"></a><h4 class="sectiontitle">Loading Multiple SQL Queries into the SQL Terminal Pane</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p6915674">You can click the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b14240444154012">Load in SQL Terminal and close History</strong> button to load selected queries into <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b521702904145">SQL Terminal</strong> and close the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b6612224904215">SQL History</strong> dialog box.</p>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p8149778">Perform the following steps to load multiple selected SQL queries into the <strong id="EN-US_TOPIC_0000001145833043__b1859810395813">SQL Terminal</strong> pane:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol56152285"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li35608518"><span>Select the required queries.</span></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li52041212"><span>Click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image4769516904921" src="figure/en-us_image_0000001145713307.jpg" height="20.9475" width="20.9475" title="Click to enlarge" class="imgResize"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p54588632">The queries are added to the cursor position in <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b511614260490">SQL Terminal</strong>.</p>
</p></li></ol>
<div class="note" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_note6922452132615"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p1315255491312">If you continue the execution upon an error, each statement in <strong id="EN-US_TOPIC_0000001145833043__b88361289517">SQL Terminal</strong> will be executed in sequence as a scheduled job. The execution status is updated in the console and each job is listed in the progress bar. When the time difference between <strong id="EN-US_TOPIC_0000001145833043__b126784713816">Job Execution</strong>, <strong id="EN-US_TOPIC_0000001145833043__b10760252585">Progress Bar Update</strong> and <strong id="EN-US_TOPIC_0000001145833043__b9136135717817">Console Update</strong> is small, you will not be able to stop the execution by opening the progress bar. In this case, you need to close <strong id="EN-US_TOPIC_0000001145833043__b123414531319">SQL Terminal</strong> to stop the execution.</p>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section132578461665"><h4 class="sectiontitle">Loading More Records</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p117083321084">To load more data in the <strong id="EN-US_TOPIC_0000001145833043__b9199204622318">Result</strong> tab, you need to scroll down to bottom, which is inconvenient in some scenarios. Data Studio provides a button that simplifies the loading operation.</p>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p11121122718117">Perform the following steps to load more records:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol12211450131519"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li942519214815"><span>Select the required queries and click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image122211313282" src="figure/en-us_image_0000001099153250.png"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p144010144274">All the required records are listed.</p>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section41363205225852"><a name="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section41363205225852"></a><a name="en-us_topic_0185264358_section41363205225852"></a><h4 class="sectiontitle">Deleting a SQL Query</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p66665241">Perform the following steps to delete a SQL query from the <strong id="EN-US_TOPIC_0000001145833043__b53191541132816">SQL History</strong> list:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol31175435"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li12143461"><span>Select the required query and click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image42182293" src="figure/en-us_image_0000001145513273.jpg" width="15.96" height="23.94" title="Click to enlarge" class="imgResize"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p44096323">A confirmation dialog box is displayed.</p>
</p></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li61322592"><span>Click <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b30641655154726">OK</strong>.</span></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section3787436422590"><a name="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section3787436422590"></a><a name="en-us_topic_0185264358_section3787436422590"></a><h4 class="sectiontitle">Deleting All SQL Queries</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p9666612">Perform the following steps to delete all SQL queries from the <strong id="EN-US_TOPIC_0000001145833043__b597561420369">SQL History</strong> list:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol44798103"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li529748"><span>Click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image4662572805130" src="figure/en-us_image_0000001145713301.jpg" height="23.94" width="20.9475" title="Click to enlarge" class="imgResize"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p42909617">A confirmation dialog box is displayed.</p>
</p></li><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li50642235"><span>Click <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b3573786154721">OK</strong>.</span></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ref471314785"><a name="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ref471314785"></a><a name="en-us_topic_0185264358_ref471314785"></a><h4 class="sectiontitle">Pinning a SQL Query</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p8314412">You can pin queries that you do not want Data Studio to delete automatically from <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b5461759923814">SQL History</strong>. You can pin a maximum of 50 queries. Pinned queries are displayed at the top of the list. The value set in <strong id="EN-US_TOPIC_0000001145833043__b9376142711487">SQL History</strong> does not affect the pinned queries. For details, see <a href="DWS_DS_138.html#EN-US_TOPIC_0000001145913107__en-us_topic_0185264581_section1382623812471">SQL History</a>.</p>
<div class="note" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_note2378778"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p class="text" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p21409010">The pinned queries are displayed at the top of the list once the <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b5618646916313_1">SQL History</strong> pane is closed and opened again.</p>
</div></div>
<p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p5668011">Perform the following steps to pin a SQL query:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol51012105"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li56455762"><span>Select the required SQL query and click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image38339817" src="figure/en-us_image_0000001145833125.jpg" width="15.96" height="15.96" title="Click to enlarge" class="imgResize"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p9514038">The <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b368082305310">Pin Status</strong> column displays the pinned status of the query.</p>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section62690964225923"><a name="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_section62690964225923"></a><a name="en-us_topic_0185264358_section62690964225923"></a><h4 class="sectiontitle">Unpinning a SQL Query</h4><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p23521075">Perform the following steps to unpin a SQL query:</p>
<ol id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_ol10363091"><li id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_li26158957"><span>Select the required SQL query and click <span><img id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_image34104028" src="figure/en-us_image_0000001145713187.jpg" width="15.96" height="15.96" title="Click to enlarge" class="imgResize"></span>.</span><p><p id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_p38500800">The <strong id="EN-US_TOPIC_0000001145833043__en-us_topic_0185264358_b2760088705316">Pin Status</strong> column displays the unpinned status of the query.</p>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="DWS_DS_118.html">SQL Terminal</a></div>
</div>
</div>
<script language="JavaScript">
<!--
image_size('.imgResize');
var msg_imageMax = "view original image";
var msg_imageClose = "close";
//--></script>