| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE html |
| PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| |
| <meta name="copyright" content="(C) Copyright 2025" /> |
| <meta name="DC.rights.owner" content="(C) Copyright 2025" /> |
| <meta name="DC.Type" content="concept" /> |
| <meta name="DC.Title" content="DML Statements" /> |
| <meta name="DC.Relation" scheme="URI" content="../topics/impala_langref_sql.html" /> |
| <meta name="prodname" content="Impala" /> |
| <meta name="prodname" content="Impala" /> |
| <meta name="version" content="Impala 3.4.x" /> |
| <meta name="version" content="Impala 3.4.x" /> |
| <meta name="DC.Format" content="XHTML" /> |
| <meta name="DC.Identifier" content="dml" /> |
| <link rel="stylesheet" type="text/css" href="../commonltr.css" /> |
| <title>DML Statements</title> |
| </head> |
| <body id="dml"> |
| |
| |
| <h1 class="title topictitle1" id="ariaid-title1">DML Statements</h1> |
| |
| |
| |
| <div class="body conbody"> |
| |
| <p class="p"> |
| DML refers to <span class="q">"Data Manipulation Language"</span>, a subset of SQL statements that modify the data stored in |
| tables. Because Impala focuses on query performance and leverages the append-only nature of HDFS storage, |
| currently Impala only supports a small set of DML statements: |
| </p> |
| |
| |
| <ul class="ul"> |
| <li class="li"> |
| <a class="xref" href="impala_delete.html">DELETE Statement (Impala 2.8 or higher only)</a>. Works for Kudu tables only. |
| </li> |
| |
| |
| <li class="li"> |
| <a class="xref" href="impala_insert.html">INSERT Statement</a>. |
| </li> |
| |
| |
| <li class="li"> |
| <a class="xref" href="impala_load_data.html">LOAD DATA Statement</a>. Does not apply for HBase or Kudu tables. |
| </li> |
| |
| |
| <li class="li"> |
| <a class="xref" href="impala_update.html">UPDATE Statement (Impala 2.8 or higher only)</a>. Works for Kudu tables only. |
| </li> |
| |
| |
| <li class="li"> |
| <a class="xref" href="impala_upsert.html">UPSERT Statement (Impala 2.8 or higher only)</a>. Works for Kudu tables only. |
| </li> |
| |
| </ul> |
| |
| |
| <p class="p"> |
| <code class="ph codeph">INSERT</code> in Impala is primarily optimized for inserting large volumes of data in a single |
| statement, to make effective use of the multi-megabyte HDFS blocks. This is the way in Impala to create new |
| data files. If you intend to insert one or a few rows at a time, such as using the <code class="ph codeph">INSERT ... |
| VALUES</code> syntax, that technique is much more efficient for Impala tables stored in HBase. See |
| <a class="xref" href="impala_hbase.html#impala_hbase">Using Impala to Query HBase Tables</a> for details. |
| </p> |
| |
| |
| <p class="p"> |
| <code class="ph codeph">LOAD DATA</code> moves existing data files into the directory for an Impala table, making them |
| immediately available for Impala queries. This is one way in Impala to work with data files produced by other |
| Hadoop components. (<code class="ph codeph">CREATE EXTERNAL TABLE</code> is the other alternative; with external tables, |
| you can query existing data files, while the files remain in their original location.) |
| </p> |
| |
| |
| <p class="p"> |
| In <span class="keyword">Impala 2.8</span> and higher, Impala does support the <code class="ph codeph">UPDATE</code>, <code class="ph codeph">DELETE</code>, |
| and <code class="ph codeph">UPSERT</code> statements for Kudu tables. |
| For HDFS or S3 tables, to simulate the effects of an <code class="ph codeph">UPDATE</code> or <code class="ph codeph">DELETE</code> statement |
| in other database systems, typically you use <code class="ph codeph">INSERT</code> or <code class="ph codeph">CREATE TABLE AS SELECT</code> to copy data |
| from one table to another, filtering out or changing the appropriate rows during the copy operation. |
| </p> |
| |
| |
| <p class="p"> |
| You can also achieve a result similar to <code class="ph codeph">UPDATE</code> by using Impala tables stored in HBase. |
| When you insert a row into an HBase table, and the table |
| already contains a row with the same value for the key column, the older row is hidden, effectively the same |
| as a single-row <code class="ph codeph">UPDATE</code>. |
| </p> |
| |
| |
| <p class="p"> |
| Impala can perform DML operations for tables or partitions stored in the Amazon S3 filesystem |
| with <span class="keyword">Impala 2.6</span> and higher. See <a class="xref" href="impala_s3.html#s3">Using Impala with Amazon S3 Object Store</a> for details. |
| </p> |
| |
| |
| <p class="p"> |
| <strong class="ph b">Related information:</strong> |
| </p> |
| |
| |
| <p class="p"> |
| The other major classifications of SQL statements are data definition language (see |
| <a class="xref" href="impala_ddl.html#ddl">DDL Statements</a>) and queries (see <a class="xref" href="impala_select.html#select">SELECT Statement</a>). |
| </p> |
| |
| </div> |
| |
| <div class="related-links"> |
| <div class="familylinks"> |
| <div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/impala_langref_sql.html">Impala SQL Statements</a></div> |
| </div> |
| </div></body> |
| </html> |