<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Working with native tables</title>
    <link>/en/admin/working-with-native-tables/</link>
    <description>Recent content in Working with native tables on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/admin/working-with-native-tables/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Admin: Creating tables</title>
      <link>/en/admin/working-with-native-tables/creating-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/creating-tables/</guid>
      <description>
        
        
        &lt;p&gt;Use the &lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-table/#&#34;&gt;CREATE TABLE&lt;/a&gt; statement to create a native table in the database &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/logical-schema/&#34; title=&#34;Consists of a set of tables and referential integrity constraints in an OpenText&amp;amp;trade; Analytics Database.&#34;&gt;logical schema&lt;/a&gt;. You can specify the columns directly, as in the following example, or you can derive a table definition from another table using a &lt;span class=&#34;sql&#34;&gt;LIKE&lt;/span&gt; or &lt;span class=&#34;sql&#34;&gt;AS&lt;/span&gt; clause. You can specify constraints, partitioning, segmentation, and other factors. For details and restrictions, see the reference page.&lt;/p&gt;
&lt;p&gt;The following example shows a basic table definition:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;CREATE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;TABLE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;orders&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;orderkey&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;INT&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;custkey&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;INT&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;prodkey&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;ARRAY&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;VARCHAR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)],&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;orderprices&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;ARRAY&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;DECIMAL&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)],&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;orderdate&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;   &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;DATE&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&#34;table-data-storage&#34;&gt;Table data storage&lt;/h2&gt;
&lt;p&gt;Unlike traditional databases that store data in tables, the database physically stores table data in &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/projection/&#34; title=&#34;Optimized collections of table columns that provide physical storage for data.&#34;&gt;projections&lt;/a&gt;, which are collections of table columns. Projections store data in a format that optimizes query execution. Similar to materialized views, they store result sets on disk rather than compute them each time they are used in a query.&lt;/p&gt;
&lt;p&gt;In order to query or perform any operation on a database table, the table must have one or more &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/projection/&#34; title=&#34;Optimized collections of table columns that provide physical storage for data.&#34;&gt;projections&lt;/a&gt; associated with it. For more information, see &lt;a href=&#34;../../../en/admin/projections/#&#34;&gt;Projections&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;deriving-a-table-definition-from-the-data&#34;&gt;Deriving a table definition from the data&lt;/h2&gt;
&lt;p&gt;You can use the &lt;a href=&#34;../../../en/sql-reference/functions/management-functions/table-functions/infer-table-ddl/#&#34;&gt;INFER_TABLE_DDL&lt;/a&gt; function to inspect Parquet, ORC, JSON, or Avro data and produce a starting point for a table definition. This function returns a CREATE TABLE statement, which might require further editing. For columns where the function could not infer the data type, the function labels the type as unknown and emits a warning. For VARCHAR and VARBINARY columns, you might need to adjust the length. Always review the statement the function returns, but especially for tables with many columns, using this function can save time and effort.&lt;/p&gt;
&lt;p&gt;Parquet, ORC, and Avro files include schema information, but JSON files do not. For JSON, the function inspects the raw data to produce one or more candidate table definitions. See the function reference page for JSON examples.&lt;/p&gt;
&lt;p&gt;In the following example, the function infers a complete table definition from Parquet input, but the VARCHAR columns use the default size and might need to be adjusted:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT INFER_TABLE_DDL(&amp;#39;/data/people/*.parquet&amp;#39;
        USING PARAMETERS format = &amp;#39;parquet&amp;#39;, table_name = &amp;#39;employees&amp;#39;);
WARNING 9311:  This generated statement contains one or more varchar/varbinary columns which default to length 80
                    INFER_TABLE_DDL
-------------------------------------------------------------------------
 create table &amp;#34;employees&amp;#34;(
  &amp;#34;employeeID&amp;#34; int,
  &amp;#34;personal&amp;#34; Row(
    &amp;#34;name&amp;#34; varchar,
    &amp;#34;address&amp;#34; Row(
      &amp;#34;street&amp;#34; varchar,
      &amp;#34;city&amp;#34; varchar,
      &amp;#34;zipcode&amp;#34; int
    ),
    &amp;#34;taxID&amp;#34; int
  ),
  &amp;#34;department&amp;#34; varchar
 );
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Parquet files, you can use the &lt;a href=&#34;../../../en/sql-reference/functions/hadoop-functions/get-metadata/#&#34;&gt;GET_METADATA&lt;/a&gt; function to inspect a file and report metadata including information about columns.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/working-with-native-tables/altering-table-definitions/#&#34;&gt;Altering table definitions&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/working-with-native-tables/creating-temporary-tables/#&#34;&gt;Creating temporary tables&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/working-with-native-tables/creating-table-from-other-tables/#&#34;&gt;Creating a table from other tables&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/data-load/working-with-external-data/creating-external-tables/#&#34;&gt;Creating external tables&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Creating temporary tables</title>
      <link>/en/admin/working-with-native-tables/creating-temporary-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/creating-temporary-tables/</guid>
      <description>
        
        
        &lt;p&gt;&lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-temporary-table/#&#34;&gt;CREATE TEMPORARY TABLE&lt;/a&gt;&lt;/span&gt; creates a table whose data persists only during the current session. Temporary table data is never visible to other sessions.&lt;/p&gt;
&lt;p&gt;By default, all temporary table data is transaction-scoped—that is, the data is discarded when a &lt;span class=&#34;sql&#34;&gt;COMMIT&lt;/span&gt; statement ends the current transaction. If &lt;span class=&#34;sql&#34;&gt;CREATE TEMPORARY TABLE&lt;/span&gt; includes the parameter &lt;span class=&#34;sql&#34;&gt;ON COMMIT PRESERVE ROWS&lt;/span&gt;, table data is retained until the current session ends.&lt;/p&gt;
&lt;p&gt;Temporary tables can be used to divide complex query processing into multiple steps. Typically, a reporting tool holds intermediate results while reports are generated—for example, the tool first gets a result set, then queries the result set, and so on.&lt;/p&gt;
&lt;p&gt;When you create a temporary table, the database automatically generates a default &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/projection/&#34; title=&#34;Optimized collections of table columns that provide physical storage for data.&#34;&gt;projection&lt;/a&gt; for it. For more information, see &lt;a href=&#34;../../../en/admin/projections/auto-projections/#&#34;&gt;Auto-projections&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a name=&#34;Global&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;global-versus-local-tables&#34;&gt;Global versus local tables&lt;/h2&gt;
&lt;p&gt;&lt;span class=&#34;sql&#34;&gt;CREATE TEMPORARY TABLE&lt;/span&gt; can create tables at two scopes, global and local, through the keywords &lt;span class=&#34;sql&#34;&gt;GLOBAL&lt;/span&gt; and &lt;span class=&#34;sql&#34;&gt;LOCAL&lt;/span&gt;, respectively:&lt;/p&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;
Global temporary tables&lt;/td&gt; 

&lt;td &gt;


The database creates global temporary tables in the public schema. Definitions of these tables are visible to all sessions, and persist across sessions until they are explicitly dropped. Multiple users can access the table concurrently. Table data is session-scoped, so it is visible only to the session user, and is discarded when the session ends.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
Local temporary tables&lt;/td&gt; 

&lt;td &gt;


The database creates local temporary tables in the &lt;code&gt;V_TEMP_SCHEMA&lt;/code&gt; namespace and inserts them transparently into the user&#39;s search path. These tables are visible only to the session where they are created. When the session ends, the database automatically drops the table and its data.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;&lt;a name=&#34;Data&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;data-retention&#34;&gt;Data retention&lt;/h2&gt;
&lt;p&gt;You can specify whether temporary table data is transaction- or session-scoped:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;#on&#34;&gt;ON COMMIT DELETE ROWS&lt;/a&gt;&lt;/span&gt; (default): the database automatically removes all table data when each transaction ends.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;#on2&#34;&gt;ON COMMIT PRESERVE ROWS&lt;/a&gt;&lt;/span&gt;: the database preserves table data across transactions in the current session. The database automatically truncates the table when the session ends.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;If you create a temporary table with &lt;span class=&#34;sql&#34;&gt;ON COMMIT PRESERVE ROWS&lt;/span&gt;, you cannot add projections for that table if it contains data. You must first remove all data from that table with &lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;../../../en/sql-reference/statements/truncate-table/#&#34;&gt;TRUNCATE TABLE&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;You can create projections for temporary tables created with &lt;span class=&#34;sql&#34;&gt;ON COMMIT DELETE ROWS&lt;/span&gt;, whether populated with data or not. However, &lt;span class=&#34;sql&#34;&gt;CREATE PROJECTION&lt;/span&gt; ends any transaction where you might have added data, so projections are always empty.&lt;/p&gt;


&lt;/div&gt;
&lt;p&gt;&lt;a name=&#34;on&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;on-commit-delete-rows&#34;&gt;ON COMMIT DELETE ROWS&lt;/h3&gt;
&lt;p&gt;By default, the database removes all data from a temporary table, whether global or local, when the current transaction ends.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TEMPORARY TABLE tempDelete (a int, b int);
CREATE TABLE
=&amp;gt; INSERT INTO tempDelete VALUES(1,2);
 OUTPUT
--------
      1
(1 row)

=&amp;gt; SELECT * FROM tempDelete;
 a | b
---+---
 1 | 2
(1 row)

=&amp;gt; COMMIT;
COMMIT

=&amp;gt; SELECT * FROM tempDelete;
 a | b
---+---
(0 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If desired, you can use &lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;../../../en/sql-reference/statements/delete/#&#34;&gt;DELETE&lt;/a&gt;&lt;/span&gt; within the same transaction multiple times, to refresh table data repeatedly.&lt;/p&gt;
&lt;p&gt;&lt;a name=&#34;on2&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;on-commit-preserve-rows&#34;&gt;ON COMMIT PRESERVE ROWS&lt;/h3&gt;
&lt;p&gt;You can specify that a temporary table retain data across transactions in the current session, by defining the table with the keywords &lt;span class=&#34;sql&#34;&gt;ON COMMIT PRESERVE ROWS&lt;/span&gt;. The database automatically removes all data from the table only when the current session ends.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TEMPORARY TABLE tempPreserve (a int, b int) ON COMMIT PRESERVE ROWS;
CREATE TABLE
=&amp;gt; INSERT INTO tempPreserve VALUES (1,2);
 OUTPUT
--------
      1
(1 row)

=&amp;gt; COMMIT;
COMMIT
=&amp;gt; SELECT * FROM tempPreserve;
 a | b
---+---
 1 | 2
(1 row)

=&amp;gt; INSERT INTO tempPreserve VALUES (3,4);
 OUTPUT
--------
      1
(1 row)

=&amp;gt; COMMIT;
COMMIT
=&amp;gt; SELECT * FROM tempPreserve;
 a | b
---+---
 1 | 2
 3 | 4
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;eon-restrictions&#34;&gt;Eon restrictions&lt;/h2&gt;
&lt;p&gt;The following Eon Mode restrictions apply to temporary tables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
K-safety of temporary tables is always set to 0, regardless of system K-safety. If a &lt;code&gt;CREATE TEMPORARY TABLE&lt;/code&gt; statement sets &lt;em&gt;&lt;code&gt;k-num&lt;/code&gt;&lt;/em&gt; greater than 0, the database returns an warning.
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If subscriptions to the current session change, temporary tables in that session becomes inaccessible. Causes for session subscription changes include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A node left the list of participating nodes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A new node appeared in the list of participating nodes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An active node changed for one or more shards.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;a href=&#34;../../../en/admin/managing-db/tuple-mover/mergeout/&#34;&gt;mergeout&lt;/a&gt; operation in the same session that is triggered by a user explicitly invoking &lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/storage-functions/do-tm-task/#&#34;&gt;DO_TM_TASK(&#39;mergeout&#39;)&lt;/a&gt;&lt;/span&gt;, or changing a column data type with &lt;span class=&#34;sql&#34;&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#AlterColumn&#34;&gt;ALTER TABLE...ALTER COLUMN&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Background mergeout operations have no effect on session subscriptions.

&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


      </description>
    </item>
    
    <item>
      <title>Admin: Creating a table from other tables</title>
      <link>/en/admin/working-with-native-tables/creating-table-from-other-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/creating-table-from-other-tables/</guid>
      <description>
        
        
        &lt;p&gt;You can create a table from other tables in two ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/creating-table-from-other-tables/replicating-table/&#34;&gt;Replicate an existing table&lt;/a&gt; through &lt;code&gt;CREATE TABLE...LIKE&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/creating-table-from-other-tables/creating-table-from-query/&#34;&gt;Create a table from a query&lt;/a&gt; through &lt;code&gt;CREATE TABLE...AS&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
You can also copy one table to another with the function
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/table-functions/copy-table/#&#34;&gt;COPY_TABLE&lt;/a&gt;&lt;/code&gt;.
&lt;/div&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Immutable tables</title>
      <link>/en/admin/working-with-native-tables/immutable-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/immutable-tables/</guid>
      <description>
        
        
        &lt;p&gt;Many secure systems contain records that must be provably immune to change. Protective strategies such as row and block checksums incur high overhead. Moreover, these approaches are not foolproof against unauthorized changes, whether deliberate or inadvertent, by database administrators or other users with sufficient privileges.&lt;/p&gt;
&lt;p&gt;Immutable tables are insert-only tables in which existing data cannot be modified, regardless of user privileges. Updating row values and deleting rows are prohibited. Certain changes to table metadata—for example, renaming table columns—are also prohibited, in order to prevent attempts to circumvent these restrictions. &lt;a href=&#34;../../../en/data-analysis/flattened-tables/&#34;&gt;Flattened&lt;/a&gt; or &lt;a href=&#34;../../../en/data-load/working-with-external-data/&#34;&gt;external&lt;/a&gt; tables, which obtain their data from outside sources, cannot be set to be immutable.&lt;/p&gt;
&lt;p&gt;You define an existing table as immutable with &lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ALTER TABLE &lt;span class=&#34;code-variable&#34;&gt;table&lt;/span&gt; SET IMMUTABLE ROWS;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once set, table immutability cannot be reverted, and is immediately applied to all existing table data, and all data that is loaded thereafter. In order to modify the data of an immutable table, you must copy the data to a new table—for example, with &lt;a href=&#34;../../../en/sql-reference/statements/copy/#&#34;&gt;COPY&lt;/a&gt;, &lt;a href=&#34;../../../en/admin/working-with-native-tables/creating-table-from-other-tables/creating-table-from-query/&#34;&gt;CREATE TABLE...AS&lt;/a&gt;, or &lt;a href=&#34;../../../en/sql-reference/functions/management-functions/table-functions/copy-table/#&#34;&gt;COPY_TABLE&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When you execute ALTER TABLE...SET IMMUTABLE ROWS on a table, the database sets two columns for that table in the system table &lt;a href=&#34;../../../en/sql-reference/system-tables/v-catalog-schema/tables/#&#34;&gt;TABLES&lt;/a&gt;. Together, these columns show when the table was made immutable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&#34;sql&#34;&gt;immutable_rows_since_timestamp&lt;/span&gt;: Server system time when immutability was applied. This is valuable for long-term timestamp retrieval and efficient comparison.&lt;/li&gt;
&lt;li&gt;&lt;span class=&#34;sql&#34;&gt;immutable_rows_since_epoch&lt;/span&gt;: The epoch that was &lt;a href=&#34;../../../en/admin/failure-recovery/epochs/epoch-life-cycle/#Current&#34;&gt;current&lt;/a&gt; when immutability was applied. This setting can help protect the table from attempts to pre-insert records with a future timestamp, so that row&#39;s epoch is less than the table&#39;s immutability epoch.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;enforcement&#34;&gt;Enforcement&lt;/h2&gt;
&lt;p&gt;The following operations are prohibited on immutable tables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/statements/update/#&#34;&gt;UPDATE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/statements/delete/#&#34;&gt;DELETE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#DropColumn&#34;&gt;ALTER TABLE...DROP COLUMN&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#RenameColumn&#34;&gt;ALTER TABLE...RENAME COLUMN&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#AddColumn&#34;&gt;ALTER TABLE...ADD COLUMN&lt;/a&gt; where the new column is defined with a &lt;a href=&#34;../../../en/admin/working-with-native-tables/managing-table-columns/defining-column-values/#SET_USING&#34;&gt;SET USING clause&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following partition management functions are disallowed when the target table is immutable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/partition-functions/copy-partitions-to-table/#&#34;&gt;COPY_PARTITIONS_TO_TABLE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/partition-functions/move-partitions-to-table/#&#34;&gt;MOVE_PARTITIONS_TO_TABLE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/partition-functions/swap-partitions-between-tables/#&#34;&gt;SWAP_PARTITIONS_BETWEEN_TABLES&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;allowed-operations&#34;&gt;Allowed operations&lt;/h2&gt;
&lt;p&gt;In general, you can execute any DML operation on an immutable table that does not affect existing row data—for example, add rows with &lt;a href=&#34;../../../en/sql-reference/statements/copy/#&#34;&gt;COPY&lt;/a&gt; or &lt;a href=&#34;../../../en/sql-reference/statements/insert/#&#34;&gt;INSERT&lt;/a&gt;. After you add data to an immutable table, it cannot be changed.

&lt;div class=&#34;alert admonition tip&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Tip&lt;/h4&gt;

A table&#39;s immutability can render meaningless certain operations that are otherwise permitted on an immutable table. For example, you can add a column to an immutable table with &lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/&#34;&gt;ALTER TABLE...ADD COLUMN&lt;/a&gt;. However, all values in the new column are set to NULL (unless the column is defined with a &lt;a href=&#34;../../../en/data-analysis/flattened-tables/default-versus-set-using/#DEFAULT&#34;&gt;DEFAULT&lt;/a&gt; value), and they cannot be updated.

&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Other allowed operations fall generally into two categories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Changes to a table&#39;s DDL that have no effect on its data:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#SetSchema&#34;&gt;ALTER TABLE...SET SCHEMA&lt;/a&gt;: Change the table schema.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#SetSchema&#34;&gt;ALTER TABLE...OWNER TO&lt;/a&gt;: Transfer table ownership.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#AlterColumn&#34;&gt;ALTER TABLE...ALTER COLUMN...SET DATATYPE&lt;/a&gt;: Change a column&#39;s data type. &lt;a href=&#34;../../../en/admin/working-with-native-tables/managing-table-columns/changing-scalar-column-data-type/&#34;&gt;Column data type changes&lt;/a&gt; are allowed only if they have no effect on the column&#39;s stored data.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Block operations on multiple table rows, or the entire table:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/partition-functions/drop-partitions/#&#34;&gt;DROP_PARTITIONS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/statements/truncate-table/#&#34;&gt;TRUNCATE TABLE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/sql-reference/statements/drop-statements/drop-table/#&#34;&gt;DROP TABLE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Disk quotas</title>
      <link>/en/admin/working-with-native-tables/disk-quotas/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/disk-quotas/</guid>
      <description>
        
        
        &lt;p&gt;By default, schemas and tables are limited only by available disk space and license capacity. You can set disk quotas for schemas or individual tables, for example, to support multi-tenancy. Setting, modifying, or removing a disk quota requires superuser privileges.&lt;/p&gt;
&lt;p&gt;Most user operations that increase storage size enforce disk quotas. A table can temporarily exceed its quota during some operations such as recovery. If you lower a quota below the current usage, no data is lost but you cannot add more. Treat quotas as advisory, not as hard limits&lt;/p&gt;
&lt;p&gt;A schema quota, if set, must be larger than the largest table quota within it.&lt;/p&gt;
&lt;p&gt;A disk quota is a string composed of an integer and a unit of measure (K, M, G, or T), such as &#39;15G&#39; or &#39;1T&#39;. Do not use a space between the number and the unit. No other units of measure are supported.&lt;/p&gt;
&lt;p&gt;To set a quota at creation time, use the &lt;span class=&#34;sql&#34;&gt;DISK_QUOTA&lt;/span&gt; option for &lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-schema/#&#34;&gt;CREATE SCHEMA&lt;/a&gt; or &lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-table/#&#34;&gt;CREATE TABLE&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE SCHEMA internal DISK_QUOTA &amp;#39;10T&amp;#39;;
CREATE SCHEMA

=&amp;gt; CREATE TABLE internal.sales (...) DISK_QUOTA &amp;#39;5T&amp;#39;;
CREATE TABLE

=&amp;gt; CREATE TABLE internal.leads (...) DISK_QUOTA &amp;#39;12T&amp;#39;;
ROLLBACK 0:  Table can not have a greater disk quota than its Schema
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To modify, add, or remove a quota on an existing schema or table, use &lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-schema/#&#34;&gt;ALTER SCHEMA&lt;/a&gt; or &lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER SCHEMA internal DISK_QUOTA &amp;#39;20T&amp;#39;;
ALTER SCHEMA

=&amp;gt; ALTER TABLE internal.sales DISK_QUOTA SET NULL;
ALTER TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can set a quota that is lower than the current usage. The ALTER operation succeeds, the schema or table is temporarily over quota, and you cannot perform operations that increase data usage.&lt;/p&gt;
&lt;h2 id=&#34;data-that-is-counted&#34;&gt;Data that is counted&lt;/h2&gt;
&lt;p&gt;In Eon Mode, disk usage is an aggregate of all space used by all shards for the schema or table. This value is computed for primary subscriptions only.&lt;/p&gt;
&lt;p&gt;In Enterprise Mode, disk usage is the sum space used by all storage containers on all nodes for the schema or table. This sum excludes buddy projections but includes all other projections.&lt;/p&gt;
&lt;p&gt;Disk usage is calculated based on compressed size.&lt;/p&gt;
&lt;h2 id=&#34;when-quotas-are-applied&#34;&gt;When quotas are applied&lt;/h2&gt;
&lt;p&gt;Quotas, if present, affect most DML and ILM operations, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/copy/#&#34;&gt;COPY&lt;/a&gt;, &lt;a href=&#34;../../../en/sql-reference/statements/insert/#&#34;&gt;INSERT&lt;/a&gt;, &lt;a href=&#34;../../../en/sql-reference/statements/update/#&#34;&gt;UPDATE&lt;/a&gt;, and &lt;a href=&#34;../../../en/sql-reference/statements/merge/#&#34;&gt;MERGE&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Adding or refreshing columns (see &lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#AlterColumn&#34;&gt;ALTER COLUMN&lt;/a&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/functions/management-functions/projection-functions/refresh/#&#34;&gt;REFRESH&lt;/a&gt; and &lt;a href=&#34;../../../en/sql-reference/functions/management-functions/projection-functions/start-refresh/#&#34;&gt;START_REFRESH&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/admin/backup-and-restore/restoring-backups/restoring-individual-objects/&#34;&gt;Subset restore of a table&lt;/a&gt;, if it would exceed the schema quota&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following example shows a failure caused by exceeding a table&#39;s quota:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE stats(score int) DISK_QUOTA &amp;#39;1k&amp;#39;;
CREATE TABLE

=&amp;gt; COPY stats FROM STDIN;
1
2
3
4
5
\.
ERROR 0: Disk Quota Exceeded for the Table object public.stats
HINT: Delete data and PURGE or increase disk quota at the table level
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href=&#34;../../../en/sql-reference/statements/delete/#&#34;&gt;DELETE&lt;/a&gt; does not free space, because deleted data is still preserved in the storage containers. The delete vector that is added by a delete operation does not count against a quota, so deleting is a quota-neutral operation. Disk space for deleted data is reclaimed when you purge it; see &lt;a href=&#34;../../../en/admin/working-with-native-tables/removing-table-data/#&#34;&gt;Removing table data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some uncommon operations, such as &lt;span class=&#34;sql&#34;&gt;ADD COLUMN&lt;/span&gt;, &lt;span class=&#34;sql&#34;&gt;RESTORE&lt;/span&gt;, and &lt;span class=&#34;sql&#34;&gt;SWAP PARTITION&lt;/span&gt;, can create new storage containers during the transaction. These operations clean up the extra locations upon completion, but while the operation is in progress, a table or schema could exceed its quota. If you get disk-quota errors during these operations, you can temporarily increase the quota, perform the operation, and then reset it.&lt;/p&gt;
&lt;p&gt;Quotas do not affect recovery, rebalancing, or Tuple Mover operations.&lt;/p&gt;
&lt;h2 id=&#34;monitoring&#34;&gt;Monitoring&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&#34;../../../en/sql-reference/system-tables/v-monitor-schema/disk-quota-usages/#&#34;&gt;DISK_QUOTA_USAGES&lt;/a&gt; system table shows current disk usage for tables and schemas that have quotas. This table does not report on objects that do not have quotas.&lt;/p&gt;
&lt;p&gt;You can use this table to monitor usage and make decisions about adjusting quotas:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM DISK_QUOTA_USAGES;
    object_oid     | object_name | is_schema | total_disk_usage_in_bytes | disk_quota_in_bytes
-------------------+-------------+-----------+---------------------+---------------------
 45035996273705100 | s           | t         |                 307 |               10240
 45035996273705104 | public.t    | f         |                 614 |                1024
 45035996273705108 | s.t         | f         |                 307 |                2048
(3 rows)
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Managing table columns</title>
      <link>/en/admin/working-with-native-tables/managing-table-columns/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/managing-table-columns/</guid>
      <description>
        
        
        &lt;p&gt;After you define a table, you can use 
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt;&lt;/code&gt; to modify existing table columns. You can perform the following operations on a column:&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Altering table definitions</title>
      <link>/en/admin/working-with-native-tables/altering-table-definitions/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/altering-table-definitions/</guid>
      <description>
        
        
        &lt;p&gt;You can modify a table&#39;s definition with 
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt;&lt;/code&gt;, in response to evolving database schema requirements. Changing a table definition is often more efficient than staging data in a temporary table, consuming fewer resources and less storage.&lt;/p&gt;
&lt;p&gt;For information on making column-level changes, see &lt;a href=&#34;../../../en/admin/working-with-native-tables/managing-table-columns/#&#34;&gt;Managing table columns&lt;/a&gt;. For details about changing and reorganizing table partitions, see &lt;a href=&#34;../../../en/admin/partitioning-tables/defining-partitions/partitioning-existing-table-data/#&#34;&gt;Partitioning existing table data&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Sequences</title>
      <link>/en/admin/working-with-native-tables/sequences/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/sequences/</guid>
      <description>
        
        
        &lt;p&gt;Sequences can be used to set the default values of columns to sequential integer values. Sequences guarantee uniqueness, and help avoid constraint enforcement problems and overhead. Sequences are especially useful for primary key columns.&lt;/p&gt;
&lt;p&gt;While sequence object values are guaranteed to be unique, they are not guaranteed to be contiguous. For example, two nodes can increment a sequence at different rates. The node with a heavier processing load increments the sequence, but the values are not contiguous with those being incremented on a node with less processing. For details, see &lt;a href=&#34;../../../en/admin/working-with-native-tables/sequences/named-sequences/distributing-sequences/#&#34;&gt;Distributing sequences&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OpenText™ Analytics Database supports the following sequence types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/sequences/named-sequences/creating-and-using-named-sequences/&#34;&gt;Named sequences&lt;/a&gt;&lt;/em&gt; are database objects that generates unique numbers in sequential ascending or descending order. Named sequences are defined independently through &lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-sequence/#&#34;&gt;CREATE SEQUENCE&lt;/a&gt; statements, and are managed independently of the tables that reference them. A table can set the default values of one or more columns to named sequences.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/sequences/identity-sequences/&#34;&gt;IDENTITY&lt;/a&gt; column sequences&lt;/em&gt; increment or decrement column&#39;s value as new rows are added. Unlike named sequences, IDENTITY sequence types are defined in a table&#39;s DDL, so they do not persist independently of that table. A table can contain only one IDENTITY column.&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Merging table data</title>
      <link>/en/admin/working-with-native-tables/merging-table-data/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/merging-table-data/</guid>
      <description>
        
        
        &lt;p&gt;
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/statements/merge/#&#34;&gt;MERGE&lt;/a&gt;&lt;/code&gt; statements can perform &lt;a href=&#34;../../../en/sql-reference/statements/update/&#34;&gt;update&lt;/a&gt; and &lt;a href=&#34;../../../en/sql-reference/statements/insert/&#34;&gt;insert&lt;/a&gt; operations on a target table based on the results of a join with a source data set. The join can match a source row with only one target row; otherwise, the database returns an error.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;MERGE&lt;/code&gt; has the following syntax:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;MERGE INTO &lt;span class=&#34;code-variable&#34;&gt;target-table&lt;/span&gt; USING &lt;span class=&#34;code-variable&#34;&gt;source-dataset&lt;/span&gt; ON  &lt;span class=&#34;code-variable&#34;&gt;join-condition&lt;/span&gt;
&lt;span class=&#34;code-variable&#34;&gt;matching-clause&lt;/span&gt;[ &lt;span class=&#34;code-variable&#34;&gt;matching-clause&lt;/span&gt; ]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Merge operations have at least three components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The target table on which to perform update and insert operations. &lt;code&gt;MERGE&lt;/code&gt; takes an X (exclusive) lock on the target table until the merge operation is complete.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/merging-table-data/merge-source-options/&#34;&gt;Join to another data set&lt;/a&gt;, one of the following: a table, view, or subquery result set.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;One or both matching clauses: 
&lt;code&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/merging-table-data/merge-matching-clauses/#WHEN_MATCHED&#34;&gt;WHEN MATCHED THEN UPDATE SET&lt;/a&gt;&lt;/code&gt; and 
&lt;code&gt;&lt;a href=&#34;../../../en/admin/working-with-native-tables/merging-table-data/merge-matching-clauses/#WHEN_NOT_MATCHED&#34;&gt;WHEN NOT MATCHED THEN INSERT&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Removing table data</title>
      <link>/en/admin/working-with-native-tables/removing-table-data/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/removing-table-data/</guid>
      <description>
        
        
        &lt;p&gt;There are several ways to remove data from a table:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Delete operation&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;a href=&#34;../../../en/admin/working-with-native-tables/dropping-tables/&#34;&gt;Drop a table&lt;/a&gt;&lt;/td&gt; 

&lt;td &gt;
Permanently remove a table and its definition, optionally remove associated views and &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/projection/&#34; title=&#34;Optimized collections of table columns that provide physical storage for data.&#34;&gt;projections&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;a href=&#34;../../../en/sql-reference/statements/delete/&#34;&gt;Delete table rows&lt;/a&gt;&lt;/td&gt; 

&lt;td &gt;


Mark rows with delete vectors and store them so data can be rolled back to a previous epoch. The data must be &lt;a href=&#34;../../../en/admin/working-with-native-tables/removing-table-data/purging-deleted-data/&#34;&gt;purged&lt;/a&gt; to reclaim disk space.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;a href=&#34;../../../en/admin/working-with-native-tables/removing-table-data/truncating-tables/&#34;&gt;Truncate table data&lt;/a&gt;&lt;/td&gt; 

&lt;td &gt;


Remove all storage and history associated with a table. The table structure is preserved for future use.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;a href=&#34;../../../en/admin/working-with-native-tables/removing-table-data/purging-deleted-data/&#34;&gt;Purge data&lt;/a&gt;&lt;/td&gt; 

&lt;td &gt;
Permanently remove historical data from physical storage and free disk space for reuse.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;a href=&#34;../../../en/admin/partitioning-tables/managing-partitions/dropping-partitions/&#34;&gt;Drop partitions&lt;/a&gt;&lt;/td&gt; 

&lt;td &gt;


Remove one more partitions from a table. Each partition contains a related subset of data in the table. Dropping partitioned data is efficient, and provides query performance benefits.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Rebuilding tables</title>
      <link>/en/admin/working-with-native-tables/rebuilding-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/rebuilding-tables/</guid>
      <description>
        
        
        &lt;p&gt;You can reclaim disk space on a large scale by rebuilding tables, as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a table with the same (or similar) definition as the table to rebuild.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create projections for the new table.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy data from the target table into the new one with 
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/statements/insert/#&#34;&gt;INSERT...SELECT&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Drop the old table and its projections.&lt;/p&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Rather than dropping the old table, you can rename it and use it as a backup copy. Before doing so, verify that you have sufficient disk space for both the new and old tables.

&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Rename the new table with 
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE...RENAME&lt;/a&gt;&lt;/code&gt;, using the name of the old table.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&#34;admonition caution&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Caution&lt;/h4&gt;

When you rebuild a table, the database purges the table of all delete vectors that precede the AHM. This prevents historical queries on any older epoch.

&lt;/div&gt;
&lt;h2 id=&#34;projection-considerations&#34;&gt;Projection considerations&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You must have enough disk space to contain the old and new projections at the same time. If necessary, you can drop some of the old projections before loading the new table. You must, however, retain at least one &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/superprojection/&#34; title=&#34;A projection that includes all columns in an anchor table.&#34;&gt;superprojection&lt;/a&gt; of the old table (or two &lt;a class=&#34;glosslink&#34; href=&#34;../../../en/glossary/buddy-projection/&#34; title=&#34;Required for K-safety.&#34;&gt;buddy&lt;/a&gt; superprojections to maintain K-safety) until the new table is loaded. (See &lt;a href=&#34;../../../en/admin/configuring-db/config-procedure/prepare-disk-storage-locations/#&#34;&gt;Prepare disk storage locations&lt;/a&gt; for disk space requirements.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can specify different names for the new projections or use &lt;code&gt;ALTER TABLE...RENAME&lt;/code&gt; to change the names of the old projections.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The relationship between tables and projections does not depend on object names. Instead, it depends on object identifiers that are not affected by rename operations. Thus, if you rename a table, its projections continue to work normally.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Dropping tables</title>
      <link>/en/admin/working-with-native-tables/dropping-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/working-with-native-tables/dropping-tables/</guid>
      <description>
        
        
        &lt;p&gt;
&lt;code&gt;&lt;a href=&#34;../../../en/sql-reference/statements/drop-statements/drop-table/#&#34;&gt;DROP TABLE&lt;/a&gt;&lt;/code&gt; drops a table from the database catalog. If any projections are associated with the table, &lt;code&gt;DROP TABLE&lt;/code&gt; returns an error message unless it also includes the &lt;code&gt;CASCADE&lt;/code&gt; option. One exception applies: the table only has an &lt;a href=&#34;../../../en/admin/projections/auto-projections/&#34;&gt;auto-generated superprojection&lt;/a&gt; (auto-projection) associated with it.&lt;/p&gt;
&lt;h2 id=&#34;using-cascade&#34;&gt;Using CASCADE&lt;/h2&gt;
&lt;p&gt;In the following example, &lt;code&gt;DROP TABLE&lt;/code&gt; tries to remove a table that has several projections associated with it. Because it omits the &lt;code&gt;CASCADE&lt;/code&gt; option, the database returns an error:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; DROP TABLE d1;
NOTICE: Constraint - depends on Table d1
NOTICE: Projection d1p1 depends on Table d1
NOTICE: Projection d1p2 depends on Table d1
NOTICE: Projection d1p3 depends on Table d1
NOTICE: Projection f1d1p1 depends on Table d1
NOTICE: Projection f1d1p2 depends on Table d1
NOTICE: Projection f1d1p3 depends on Table d1
ERROR: DROP failed due to dependencies: Cannot drop Table d1 because other objects depend on it
HINT: Use DROP ... CASCADE to drop the dependent objects too.
=&amp;gt; DROP TABLE d1 CASCADE;
DROP TABLE
=&amp;gt; CREATE TABLE mytable (a INT, b VARCHAR(256));
CREATE TABLE
=&amp;gt; DROP TABLE IF EXISTS mytable;
DROP TABLE
=&amp;gt; DROP TABLE IF EXISTS mytable; -- Doesn&amp;#39;t exist
NOTICE:  Nothing was dropped
DROP TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The next attempt includes the &lt;code&gt;CASCADE&lt;/code&gt; option and succeeds:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; DROP TABLE d1 CASCADE;
DROP TABLE
=&amp;gt; CREATE TABLE mytable (a INT, b VARCHAR(256));
CREATE TABLE
=&amp;gt; DROP TABLE IF EXISTS mytable;
DROP TABLE
=&amp;gt; DROP TABLE IF EXISTS mytable; -- Doesn&amp;#39;t exist
NOTICE:  Nothing was dropped
DROP TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;using-if-exists&#34;&gt;Using IF EXISTS&lt;/h2&gt;
&lt;p&gt;In the following example, &lt;code&gt;DROP TABLE&lt;/code&gt; includes the option &lt;code&gt;IF EXISTS&lt;/code&gt;. This option specifies not to report an error if one or more of the tables to drop does not exist. This clause is useful in SQL scripts—for example, to ensure that a table is dropped before you try to recreate it:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; DROP TABLE IF EXISTS mytable;
DROP TABLE
=&amp;gt; DROP TABLE IF EXISTS mytable; -- Table doesn&amp;#39;t exist
NOTICE:  Nothing was dropped
DROP TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;dropping-and-restoring-view-tables&#34;&gt;Dropping and restoring view tables&lt;/h2&gt;
&lt;p&gt;Views that reference a table that is dropped and then replaced by another table with the same name continue to function and use the contents of the new table. The new table must have the same column definitions.&lt;/p&gt;

      </description>
    </item>
    
  </channel>
</rss>
