<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Tips from the Team — Vertica Forum</title>
        <link>https://forum.vertica.com/</link>
        <pubDate>Wed, 13 May 2026 10:29:32 +0000</pubDate>
        <language>en</language>
            <description>Tips from the Team — Vertica Forum</description>
    <atom:link href="https://forum.vertica.com/categories/tips-from-the-team/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>Checking and improving column compression and encoding</title>
        <link>https://forum.vertica.com/discussion/241080/checking-and-improving-column-compression-and-encoding</link>
        <pubDate>Thu, 07 Nov 2019 16:26:35 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Bryan_H</dc:creator>
        <guid isPermaLink="false">241080@/discussions</guid>
        <description><![CDATA[<p>Vertica tip: checking and improving column compression and encoding</p>

<p>When working with terabytes of data, storage and transfer become major time and cost sinks.  Vertica can help minimize storage cost and transfer time with column compression and encoding.</p>

<p>How can we identify Vertica tables that might benefit from compression?  Information about column size and current compression is stored across column_storage and projection_columns table.  The following query will locate tables that have default (AUTO) compression, which could be sub-optimal or even no compression at all: (The WHERE clause eliminates flex tables[1] and system schemas that can't be edited)</p>

<blockquote><div>
  <p>select distinct anchor_table_schema,anchor_table_name,MAX(encoding_type),SUM(ros_used_bytes)<br />
  from column_storage cs inner join projection_columns pc using (column_id)<br />
  where column_name NOT IN ('__raw__','__identity__') AND anchor_table_schema NOT LIKE '%dbd%'<br />
  group by anchor_table_schema,anchor_table_name having max(encoding_type) = 'AUTO'<br />
  order by anchor_table_schema,anchor_table_name;</p>
</div></blockquote>

<p>Let's work with an example:</p>

<blockquote><div>
  <p>anchor_table_schema |     anchor_table_name     | MAX  |    SUM<br />
  ---------------------+---------------------------+------+------------<br />
   public              | big_fact_table            | AUTO | 6841357747</p>
</div></blockquote>

<p>This table has no projections with compression.  We can have Vertica determine optimized compression using the meta-function DESIGNER_DESIGN_PROJECTION_ENCODINGS, which will output a projection definition with compression:</p>

<blockquote><div>
  <p>SELECT DESIGNER_DESIGN_PROJECTION_ENCODINGS('public.big_fact_table','');</p>
</div></blockquote>

<p>This will output a script that will create a new projection and drop the existing one (likely a super-projection).  Let's first see how much space we could save though.  I'll run the script right up to the MAKE_AHM_NOW()<br />
so there's data in the projection and compare the projection sizes:</p>

<blockquote><div>
  <p>=&gt; select anchor_table_name, projection_name, used_bytes from projection_storage where anchor_table_name = 'big_fact_table' limit 5;<br />
   anchor_table_name |             projection_name             | used_bytes<br />
  -------------------+-----------------------------------------+------------<br />
   big_fact_table    | big_fact_table_DBD_1_seg_EncodingDesign | 2331490442<br />
   big_fact_table    | big_fact_table_super                    | 6843970195</p>
</div></blockquote>

<p>That's a 65% size reduction - your mileage may vary, of course!  But at terabyte scale, even a smaller savings will still help with storage usage and processing speed because you're now moving about that much less data over network and I/O channels too.</p>

<p>Have fun and get saving!  Contact us on the forum if you'd like to talk about projection design and compression.</p>

<p>For more information:</p>

<p>COLUMN_STORAGE system table: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FSystemTables%2FMONITOR%2FCOLUMN_STORAGE.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/MONITOR/COLUMN_STORAGE.htm</a><br />
PROJECTION_COLUMNS system table: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FSystemTables%2FCATALOG%2FPROJECTION_COLUMNS.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/CATALOG/PROJECTION_COLUMNS.htm</a><br />
PROJECTION_STORAGE system table: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FSystemTables%2FMONITOR%2FPROJECTION_STORAGE.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/MONITOR/PROJECTION_STORAGE.htm</a><br />
DataBase Designer DESIGNER_DESIGN_PROJECTION_ENCODINGS meta-function: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FFunctions%2FVerticaFunctions%2FDatabaseDesigner%2FDESIGNER_DESIGN_PROJECTION_ENCODINGS.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/Functions/VerticaFunctions/DatabaseDesigner/DESIGNER_DESIGN_PROJECTION_ENCODINGS.htm</a></p>

<p>[1] It is possible to run DESIGNER_DESIGN_PROJECTION_ENCODINGS on materialized columns in flex tables, but you need to run on the materialized projection, not the flex table itself.  Here's an abridged example:</p>

<blockquote><div>
  <p>dbadmin=&gt; CREATE FLEX TABLE foo();<br />
  dbadmin=&gt; INSERT /*+ DIRECT */ INTO foo SELECT c FROM some_big_table;<br />
  dbadmin=&gt; SELECT compute_flextable_keys('foo');<br />
  dbadmin=&gt; SELECT materialize_flextable_columns('foo', 1);<br />
  dbadmin=&gt; SELECT projection_name, encoding_type FROM projection_columns WHERE projection_column_name = 'c' AND projection_name ILIKE 'foo%';<br />
  projection_name | encoding_type<br />
  -----------------+---------------<br />
  foo_b1          | AUTO<br />
  foo_b0          | AUTO<br />
  (2 rows)<br />
  dbadmin=&gt; SELECT DISTINCT projection_basename FROM projections WHERE anchor_table_name = 'foo';</p>
  
  <h2 data-id="projection-basename">projection_basename</h2>
  
  <p>foo<br />
  (1 row)<br />
  dbadmin=&gt; SELECT designer_design_projection_encodings('foo', '/home/dbadmin/foo.sql', TRUE, TRUE);<br />
  dbadmin=&gt; SELECT projection_name, encoding_type FROM projection_columns WHERE projection_column_name = 'c' AND projection_name ILIKE 'foo%';<br />
  projection_name |  encoding_type<br />
  -----------------+------------------<br />
  foo_b1          | COMMONDELTA_COMP<br />
  foo_b0          | COMMONDELTA_COMP<br />
  (2 rows)</p>
</div></blockquote>
]]>
        </description>
    </item>
    <item>
        <title>What Version of Vertica am I Running?</title>
        <link>https://forum.vertica.com/discussion/239736/what-version-of-vertica-am-i-running</link>
        <pubDate>Thu, 14 Jun 2018 14:39:43 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>[Deleted User]</dc:creator>
        <guid isPermaLink="false">239736@/discussions</guid>
        <description><![CDATA[<p>Jim Knicely authored this tip.</p>

<p>The built-in VERSION function returns a VARCHAR that contains your Vertica node’s version information.</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT version();
              version
------------------------------------
Vertica Analytic Database v9.1.0-2
(1 row)
</pre>

<p>The Vertica version is formatted as X.Y.Z-R, where…</p>

<ul><li>X.Y is the two-digit Vertica major release number, e.g., 8.1, 9.0 and 9.1</li>
<li>Z is the service pack number, e.g., 7.2.3, 8.1.1 and 9.0.1</li>
<li>R is the hotfix number, e.g., 9.0.1-9 and 9.1.0-2</li>
</ul><p>Have Fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>Partition a Table By More Than One Column</title>
        <link>https://forum.vertica.com/discussion/240524/partition-a-table-by-more-than-one-column</link>
        <pubDate>Wed, 03 Apr 2019 19:14:44 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">240524@/discussions</guid>
        <description><![CDATA[<p>The Vertica partitioning capability divides one large table into smaller pieces based on values in one or more columns. Partitions can make data lifecycle management easier and improve the performance of queries whose predicate is included in the partition expression.</p>

<p>To partition a table by more than one column, use the HASH function!</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; CREATE TABLE some_fact_table (c1 INT NOT NULL, c2 INT NOT NULL, c3 VARCHAR(1) NOT NULL, c4 INT, c5 VARCHAR(100)) PARTITION BY (c1, c2);
ERROR 4331:  PARTITION BY expression cannot return a tuple

dbadmin=&gt; CREATE TABLE some_fact_table (c1 INT NOT NULL, c2 INT NOT NULL, c3 VARCHAR(1) NOT NULL, c4 INT, c5 VARCHAR(100)) PARTITION BY HASH(c1, c2);
CREATE TABLE
</pre>

<p><strong>Helpful Link:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.2.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FStatements%2Fpartition-clause.htm">https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/Statements/partition-clause.htm</a></p>

<p>Have fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>How to make auto start Vertica  DB  after reboot  vertica node  in vertica version 12.0</title>
        <link>https://forum.vertica.com/discussion/242945/how-to-make-auto-start-vertica-db-after-reboot-vertica-node-in-vertica-version-12-0</link>
        <pubDate>Mon, 13 Mar 2023 06:34:05 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>navaneet</dc:creator>
        <guid isPermaLink="false">242945@/discussions</guid>
        <description><![CDATA[<p>How to make auto start Vertica  DB  after reboot  vertica node  in vertica version 12.0 <br />
As of now vertica  db is not starting automatically after rebooting vertica  node  of vertion 12 . <br />
How to make vertica db come UP automaticall after rebooting vertica node .</p>

<p>Any sugestions help. <br />
Thanks <br />
Navaneet</p>
]]>
        </description>
    </item>
    <item>
        <title>SQL Reserved Words</title>
        <link>https://forum.vertica.com/discussion/239719/sql-reserved-words</link>
        <pubDate>Mon, 11 Jun 2018 17:29:39 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>[Deleted User]</dc:creator>
        <guid isPermaLink="false">239719@/discussions</guid>
        <description><![CDATA[<p>Jim Knicely authored this tip.</p>

<p>Keywords are words that have a specific meaning in the SQL language. Every SQL statement contains one or more keywords. Many keywords are also reserved words. Vertica recommends that you not use reserved words as names for objects, or as identifiers. Including reserved words can make your SQL statements confusing.</p>

<p>You can query the V_CATALOG.STANDARD_KEYWORDS system table to find the list of Vertica SQL reserved words.</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT *FROM v_catalog.standard_keywords WHERE reserved = 'R' ORDER BY standard_version DESC LIMIT 1;
 keyword | standard_version | reserved
---------+------------------+----------
ABS     |             2011 | R
(1 row)
</pre>

<p>Notice how the number of reserved words increases by ANSI SQL version:</p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT standard_version, COUNT(*) reserved_word_cnt FROM v_catalog.standard_keywords WHERE reserved = 'R' GROUP BY standard_version ORDER BY 1;
 standard_version | reserved_word_cnt
------------------+-------------------
              1992 |               227
              2003 |               288
              2008 |               298
              2011 |               357
(4 rows)
</pre>

<p>Have Fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>How to convert numeric value stored in histogram data to timestamp</title>
        <link>https://forum.vertica.com/discussion/242328/how-to-convert-numeric-value-stored-in-histogram-data-to-timestamp</link>
        <pubDate>Wed, 21 Jul 2021 13:48:02 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Hibiki</dc:creator>
        <guid isPermaLink="false">242328@/discussions</guid>
        <description><![CDATA[<p>In "Customer Use Cases" part of "Tuning Vertica for Performance at Scale" session in Vertica Unify 2021, I show you the example of the histogram data stored in Vertica to explain why the query plan indicates PREDICATE VALUE OUT-OF-RANGE. That histogram data is for the timestamp data type. Even if the data type is the timestamp, Vertica handles that histogram data as the numeric value. So you need to convert the numeric value to the timestamp value to know the actual value.</p>

<p>To convert it, use:</p>

<pre spellcheck="false" tabindex="0">SELECT to_timestamp_tz((&lt;Value in histogram data&gt; / 1000000) + 946684800);
</pre>
]]>
        </description>
    </item>
    <item>
        <title>Accessing external files in an encrypted zone on HDFS using webhdfs</title>
        <link>https://forum.vertica.com/discussion/242294/accessing-external-files-in-an-encrypted-zone-on-hdfs-using-webhdfs</link>
        <pubDate>Mon, 28 Jun 2021 16:43:41 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>poojan</dc:creator>
        <guid isPermaLink="false">242294@/discussions</guid>
        <description><![CDATA[<p>If you try to open a file in encrypted zone using curl it fails. As you can see, it is complaining that the 'hdfs' user did not have permission to run DECRYPT_EEK (even though I am using 'test_user' user).</p>

<p>curl -L --negotiate -u : "<a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=http%3A%2F%2Fnamenode1%3A9870%2Fwebhdfs%2Fv1%2Ftmp%2Fencr%2Ftest.txt%3Fop%3DOPEN">http://namenode1:9870/webhdfs/v1/tmp/encr/test.txt?op=OPEN</a>"<br />
{"RemoteException":{"exception":"AuthorizationException","javaClassName":"org.apache.hadoop.security.authorize.AuthorizationException","message":"User:hdfs not allowed to do 'DECRYPT_EEK' on 'hdp_cluster_key'"}</p>

<p>Solution is to remove hdfs from the hadoop.kms.blacklist.DECRYPT_EEK property from hdfs-site.xml</p>

<p>curl -L --negotiate -u : "<a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=http%3A%2F%2Fnamenode1%3A9870%2Fwebhdfs%2Fv1%2Ftmp%2Fencr%2Ftest.txt%3Fop%3DOPEN%26user.name%3Dtest_user">http://namenode1:9870/webhdfs/v1/tmp/encr/test.txt?op=OPEN&amp;user.name=test_user</a>"<br />
a|1<br />
b|2</p>

<p>Vertica's webhdfs uses curl lib underneath the hood to access the webhdfs rest API so removing hdfs from blacklist will also enable Vertica to read from encrypted hdfs zone.</p>

<p>Refer<br />
HWX: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fdocs.hortonworks.com%2FHDPDocuments%2FHDP2%2FHDP-2.3.0%2Fbk_hdfs_admin_tools%2Fcontent%2Fwebhdfs-hdfs-encr.html">https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_hdfs_admin_tools/content/webhdfs-hdfs-encr.html</a><br />
Cloudera: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.cloudera.com%2Fdocumentation%2Fenterprise%2F5-5-x%2Ftopics%2Fcdh_sg_kms_security.html">https://www.cloudera.com/documentation/enterprise/5-5-x/topics/cdh_sg_kms_security.html</a></p>
]]>
        </description>
    </item>
    <item>
        <title>Vertica Machine Images for AWS and GCP</title>
        <link>https://forum.vertica.com/discussion/242264/vertica-machine-images-for-aws-and-gcp</link>
        <pubDate>Thu, 03 Jun 2021 22:08:22 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Bryan_H</dc:creator>
        <guid isPermaLink="false">242264@/discussions</guid>
        <description><![CDATA[<p>Here are the AWS AMI ID's for Vertica 10.1.1-1 on Amazon Linux:<br />
         "us-east-1"        : {"AMI" : "ami-03880a6dd88d100a8"},<br />
          "us-east-2"        : {"AMI" : "ami-0d3f9740fb8dcd4af"},<br />
          "us-west-1"        : {"AMI" : "ami-006760ded4263d716"},<br />
          "us-west-2"        : {"AMI" : "ami-0de74da2617070b30"},<br />
          "ca-central-1"        : {"AMI" : "ami-047dd05df809b8a59"},<br />
          "eu-central-1"        : {"AMI" : "ami-02cacffee14ef984b"},<br />
          "eu-west-1"        : {"AMI" : "ami-049089cfdefa4f512"},<br />
          "eu-west-2"        : {"AMI" : "ami-0f0622548b946fc1b"},<br />
          "ap-southeast-1"        : {"AMI" : "ami-0b889dbf7835a4f5b"},<br />
          "ap-southeast-2"        : {"AMI" : "ami-0bfcd13547a3ec7b9"},<br />
          "ap-south-1"        : {"AMI" : "ami-04dc362b21b5caec1"},<br />
          "ap-northeast-1"        : {"AMI" : "ami-08b0a80b0f8284c29"},<br />
          "ap-northeast-2"        : {"AMI" : "ami-0ac6e3d690a6fb355"},<br />
          "sa-east-1"        : {"AMI" : "ami-0d6874a32eb6a337b"}<br />
Here is the GCP source image for 10.1.1-0 on CentOS 7.6:<br />
sourceImage: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.googleapis.com%2Fcompute%2Fv1%2Fprojects%2Fvertica-public-163918%2Fglobal%2Fimages%2Fvertica-10-1-1-0-centos-7-6-mcga">https://www.googleapis.com/compute/v1/projects/vertica-public-163918/global/images/vertica-10-1-1-0-centos-7-6-mcga</a><br />
This post will be updated regularly as new platforms and releases become available.</p>
]]>
        </description>
    </item>
    <item>
        <title>Storing source file names when loading data</title>
        <link>https://forum.vertica.com/discussion/242238/storing-source-file-names-when-loading-data</link>
        <pubDate>Thu, 13 May 2021 15:48:19 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Bryan_H</dc:creator>
        <guid isPermaLink="false">242238@/discussions</guid>
        <description><![CDATA[<p>You can manipulate fields when loading data with the COPY command, but did you know you can also store the source file name?  Let's see how:</p>

<p>Suppose I have hourly data files in the pattern hourlyXX.csv where XX is the hour from 00-23.  I want to load them into a single staging table.</p>

<p>Let's define the staging table:</p>

<p>dbadmin=&gt; create table hourly (filename VARCHAR, symbol VARCHAR, tm TIME, q1 int, q2 int, q3 int);</p>

<p>COPY data with "filename" set to the source file name or CURRENT_LOAD_SOURCE() and use a wildcard to match all "hourly" files:</p>

<p>dbadmin=&gt; COPY hourly (filename AS CURRENT_LOAD_SOURCE(), symbol, tm, q1, q2, q3) FROM '/tmp/hourly*.csv';</p>

<p>Now let's see what we loaded:</p>

<p>dbadmin=&gt; select * from hourly ;<br />
     filename      | symbol |    tm    | q1 | q2 | q3<br />
-------------------+--------+----------+----+----+----<br />
 /tmp/hourly00.csv | AAA    | 00:01:02 |  1 |  2 |  3<br />
 /tmp/hourly00.csv | BBB    | 00:02:04 |  1 |  2 |  3<br />
 /tmp/hourly01.csv | AAA    | 01:01:02 |  1 |  2 |  3<br />
 /tmp/hourly01.csv | BBB    | 01:02:04 |  1 |  2 |  3<br />
 /tmp/hourly02.csv | AAA    | 02:01:02 |  1 |  2 |  3<br />
 /tmp/hourly02.csv | BBB    | 02:02:04 |  1 |  2 |  3</p>

<p>This is another way Vertica can help process data on load and avoid multiple staging steps.  Let us know how it works for you!</p>

<p>Reference:<br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F10.1.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FFunctions%2FCurrentLoad%2FCURRENT_LOAD_SOURCE.htm">https://www.vertica.com/docs/10.1.x/HTML/Content/Authoring/SQLReferenceManual/Functions/CurrentLoad/CURRENT_LOAD_SOURCE.htm</a></p>
]]>
        </description>
    </item>
    <item>
        <title>REGR_SLOPE PRECISION</title>
        <link>https://forum.vertica.com/discussion/242167/regr-slope-precision</link>
        <pubDate>Thu, 01 Apr 2021 16:47:43 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>SruthiA</dc:creator>
        <guid isPermaLink="false">242167@/discussions</guid>
        <description><![CDATA[<p>REGR_SLOPE function returns the slope of the regression line, determined by a set of expression pairs. The return value is of type DOUBLE PRECISION. It is possible that you will get different results in different clusters with various types of cloud deployments such as cloud, on premises and so on… let us review it with an example.</p>

<p>We have a table named cpu in with the following records in 2 different clusters.</p>

<p>dbadmin=&gt; select * from cpu;<br />
 cpu_util | timestamp_utc<br />
----------+---------------<br />
     1.86 |    1539251662<br />
     1.83 |    1539251662<br />
      1.8 |    1539251700<br />
     2.06 |    1539251700<br />
      1.2 |    1539252100<br />
     0.91 |    1539252102<br />
     0.63 |    1539252200<br />
     1.35 |    1539252400<br />
     1.13 |    1539252700<br />
     0.97 |    1539252800<br />
     1.53 |    1539252800<br />
      1.6 |    1539252800<br />
     1.02 |    1539252900<br />
     1.11 |    1539252900<br />
     1.28 |    1539253100<br />
     0.87 |    1539253500<br />
     0.96 |    1539253500<br />
     1.03 |    1539336600<br />
     1.13 |    1539336900<br />
     1.31 |    1539337200<br />
(20 rows)</p>

<p>dbadmin=&gt;</p>

<p>Results in cluster 1(3 node cluster):  It is consistent for every run and it resulted same output as follows.</p>

<p>dbadmin=&gt; select regr_slope (cpu_util,timestamp_utc/86400) AS cpu_util_slope from cpu;</p>

<h2 data-id="cpu-util-slope">   cpu_util_slope</h2>

<p>-0.158649414072066<br />
(1 row)</p>

<p>Results in cluster 2(2 node cluster):  Results varied for every run. Please find the sample outputs below.</p>

<p>dbadmin=&gt; select regr_slope (cpu_util,timestamp_utc/86400) AS cpu_util_slope from cpu;<br />
     cpu_util_slope</p>

<hr /><p>-0.158649476255395<br />
  (1 row)</p>

<p>dbadmin=&gt; select regr_slope (cpu_util,timestamp_utc/86400) AS cpu_util_slope from cpu;<br />
     cpu_util_slope</p>

<hr /><p>-0.158649414024238<br />
  (1 row)</p>

<p>dbadmin=&gt; select regr_slope (cpu_util,timestamp_utc/86400) AS cpu_util_slope from cpu;<br />
     cpu_util_slope</p>

<hr /><p>-0.158649476255395<br />
  (1 row)</p>

<p>Why is it so?</p>

<p>64-bit float is accurate to 15-16 digits.  Summations are going to lose a digit or two from the most significant digit in any of the summed items.  Multiplications are also present in regr_slope, which basically cuts the number of digits in half. So you'd expect about 7 digits of precision here, and we have same result till 7 digit precision. Hence all the results are accurate.</p>
]]>
        </description>
    </item>
    <item>
        <title>Using admintools to List Nodes for a Particular Database</title>
        <link>https://forum.vertica.com/discussion/239917/using-admintools-to-list-nodes-for-a-particular-database</link>
        <pubDate>Thu, 13 Sep 2018 13:45:22 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">239917@/discussions</guid>
        <description><![CDATA[<p>The Vertica Administration tools allow you to easily perform administrative tasks such as quickly viewing information and statuses of all database nodes via the list_allnodes tool.</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">[dbadmin@vertica01 ~]$ admintools -t list_allnodes
Node                    | Host          | State | Version         | DB
-------------------------+---------------+-------+-----------------+--------------
v_port_5432_node0001    | 192.168.2.200 | DOWN  | vertica-9.1.1.1 | port_5432
v_port_5435_node0001    | 192.168.2.200 | DOWN  | vertica-9.1.1.1 | port_5435
v_rename_me_node0001    | 192.168.2.200 | DOWN  | vertica-9.1.1.1 | rename_me
v_rename_me_node0002    | 192.168.2.201 | DOWN  | vertica-9.1.1.1 | rename_me
v_rename_me_node0003    | 192.168.2.202 | DOWN  | vertica-9.1.1.1 | rename_me
v_sfdc_node0001         | 192.168.2.200 | DOWN  | vertica-9.1.1.1 | sfdc
v_test_4_nodes_node0001 | 192.168.2.200 | DOWN  | vertica-9.1.1.1 | test_4_nodes
v_test_4_nodes_node0002 | 192.168.2.201 | DOWN  | vertica-9.1.1.1 | test_4_nodes
v_test_4_nodes_node0003 | 192.168.2.202 | DOWN  | vertica-9.1.1.1 | test_4_nodes
v_test_4_nodes_node0004 | 192.168.2.203 | DOWN  | unavailable     | test_4_nodes
v_test_db_node0001      | 192.168.2.200 | UP    | vertica-9.1.1.1 | test_db
v_test_db_node0002      | 192.168.2.201 | UP    | vertica-9.1.1.1 | test_db
v_test_db_node0003      | 192.168.2.202 | UP    | vertica-9.1.1.1 | test_db
</pre>

<p>If I only want to see the IP addresses and states of the nodes from a particular database, I could combine the Linux grep and awk commands to limit the output of admintools like so:</p>

<pre spellcheck="false" tabindex="0">[dbadmin@vertica01 ~]$ admintools -t list_allnodes | grep test_db | awk '{print $1,$3,$5}'
v_test_db_node0001 192.168.2.200 UP
v_test_db_node0002 192.168.2.201 UP
v_test_db_node0003 192.168.2.202 UP
</pre>

<p><strong>Helpful link:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fmy.vertica.com%2Fdocs%2F9.1.x%2FHTML%2Findex.htm%23Authoring%2FConceptsGuide%2FComponents%2FTheAdministrationTools.htm">https://my.vertica.com/docs/9.1.x/HTML/index.htm#Authoring/ConceptsGuide/Components/TheAdministrationTools.htm</a></p>

<p>Have fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>Split a string into parts</title>
        <link>https://forum.vertica.com/discussion/239410/split-a-string-into-parts</link>
        <pubDate>Thu, 01 Feb 2018 20:04:05 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>[Deleted User]</dc:creator>
        <guid isPermaLink="false">239410@/discussions</guid>
        <description><![CDATA[<p>This blog post was authored by Jim Knicely.</p>

<p>One of my favorite functions in Vertica is named SPLIT_PART. It splits up a string into parts by a given delimiter.</p>

<p>Example:</p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT split_part(my_text, ',', 1) the_first_part,
dbadmin-&gt;        split_part(my_text, ',', 2) the_second_part,
dbadmin-&gt;        split_part(my_text, ',', 3) the_third_part,
dbadmin-&gt;        split_part(my_text, ',', 4) the_fourth_part
dbadmin-&gt;   FROM (SELECT 'ONE,TWO,THREE,FOUR' my_text) foo;
the_first_part | the_second_part | the_third_part | the_fourth_part
----------------+-----------------+----------------+-----------------
ONE            | TWO             | THREE          | FOUR
(1 row)
</pre>

<p>But what if I don’t know how many parts there are in my text? As the following example shows, I can use the ROW NUMBER analytic function to dynamically split my text up!</p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT * FROM split_this_up ORDER BY 1;
id |               some_text
----+----------------------------------------
  1 | Please split this sentence up by word
  2 | And do the same with this sentence too
(2 rows)

dbadmin=&gt; SELECT id, word
dbadmin-&gt;   FROM (SELECT id, split_part(some_text, ' ', row_number() over (PARTITION BY id)) word
dbadmin(&gt;            FROM split_this_up
dbadmin(&gt;            CROSS JOIN columns) foo
dbadmin-&gt;  WHERE word &lt;&gt; '';
id |   word
----+----------
  1 | Please
  1 | split
  1 | this
  1 | sentence
  1 | up
  1 | by
  1 | word
  2 | And
  2 | do
  2 | the
  2 | same
  2 | with
  2 | this
  2 | sentence
  2 | too
(15 rows)
</pre>
]]>
        </description>
    </item>
    <item>
        <title>Have VSQL Beep Upon Command Completion</title>
        <link>https://forum.vertica.com/discussion/240952/have-vsql-beep-upon-command-completion</link>
        <pubDate>Sat, 07 Sep 2019 12:38:35 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">240952@/discussions</guid>
        <description><![CDATA[<p>There are a lot of cool command line options available to VSQL. One of my favorites is the –b option which causes Vertica to “beep” when a command completes. This is very useful if you are running a very long sequence of SQL commands via a script. You can go off and do other things while the script runs. VSQL will “beep” once letting you know latter that the script has completed!</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">[dbadmin@SE-Sandbox-26-node1 ~]$ cat beep.sql
SELECT version();
SELECT sysdate;
SELECT user;
SELECT 'SOME_DATA';
SELECT 'SOME MORE DATA';
-- Alot more stuff...
SELECT sysdate;

[dbadmin@SE-Sandbox-26-node1 ~]$ vsql -bf beep.sql -o beep.log

&lt;&lt; I heard a “Beep” &gt;&gt;

[dbadmin@SE-Sandbox-26-node1 ~]$ cat beep.log
              version
------------------------------------
Vertica Analytic Database v9.2.1-5
(1 row)

          sysdate
----------------------------
2019-09-03 15:54:41.510405
(1 row)

current_user
--------------
dbadmin
(1 row)

?column?
-----------
SOME_DATA
(1 row)

   ?column?
----------------
SOME MORE DATA
(1 row)

          sysdate
---------------------------
2019-09-03 15:54:41.53582
(1 row)
</pre>

<p><strong>Helpful Link:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.2.x%2FHTML%2FContent%2FAuthoring%2FConnectingToVertica%2Fvsql%2FCommandLineOptions.htm">https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/ConnectingToVertica/vsql/CommandLineOptions.htm</a></p>

<p>Have fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>recovery failing after power outage</title>
        <link>https://forum.vertica.com/discussion/241885/recovery-failing-after-power-outage</link>
        <pubDate>Thu, 08 Oct 2020 14:37:27 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>bertramf</dc:creator>
        <guid isPermaLink="false">241885@/discussions</guid>
        <description><![CDATA[<p>Hi, I have a test environment that experienced a power outage on all 3 nodes (vertica-9.2.0-7) and the storage array. The system is not critical but it's weird that I cannot get the DB to recover:</p>

<pre spellcheck="false" tabindex="0">[dbadmin@vdb2 ~]$ admintools -t start_db -d opsadb -U
Info: no password specified, using none
    Starting nodes: 
        v_opsadb_node0001 (192.168.252.31)
        v_opsadb_node0002 (192.168.252.216)
        v_opsadb_node0003 (192.168.252.217)
    Starting Vertica on all nodes. Please wait, databases with a large catalog may take a while to initialize.
    Node Status: v_opsadb_node0001: (DOWN) v_opsadb_node0002: (DOWN) v_opsadb_node0003: (DOWN) 
    Node Status: v_opsadb_node0001: (DOWN) v_opsadb_node0002: (DOWN) v_opsadb_node0003: (DOWN) 
    Node Status: v_opsadb_node0001: (DOWN) v_opsadb_node0002: (DOWN) v_opsadb_node0003: (DOWN) 
    Node Status: v_opsadb_node0001: (DOWN) v_opsadb_node0002: (DOWN) v_opsadb_node0003: (DOWN) 
    Node Status: v_opsadb_node0001: (DOWN) v_opsadb_node0002: (DOWN) v_opsadb_node0003: (DOWN) 
    Node Status: v_opsadb_node0001: (DOWN) v_opsadb_node0002: (DOWN) v_opsadb_node0003: (DOWN) 
    Node Status: v_opsadb_node0001: (UP) v_opsadb_node0002: (UP) v_opsadb_node0003: (UP) 
Database opsadb: Startup Succeeded.  All Nodes are UP
[dbadmin@vdb2 ~]$ vsql 
...
dbadmin=&gt; SELECT get_ahm_epoch();
 get_ahm_epoch 
---------------
     109626381
(1 row)
dbadmin=&gt; SELECT get_expected_recovery_epoch();
INFO 4544:  Recovery Epoch Computation:
Node Dependencies:
011 - cnt: 847
101 - cnt: 847
110 - cnt: 847
111 - cnt: 158

001 - name: v_opsadb_node0001
010 - name: v_opsadb_node0002
100 - name: v_opsadb_node0003
Nodes certainly in the cluster:
    Node 2(v_opsadb_node0003), epoch 109610889
    Node 1(v_opsadb_node0002), epoch 104348833
Filling more nodes to satisfy node dependencies:
Data dependencies fulfilled, remaining nodes LGEs don't matter:
    Node 0(v_opsadb_node0001), epoch 104348128
--
 get_expected_recovery_epoch 
-----------------------------
                   104348833
(1 row)
</pre>

<p>So far so good, we should be able to recover to 104348833. But:</p>

<pre spellcheck="false" tabindex="0">[dbadmin@vdb2 ~]$ admintools -t restart_db -d opsadb -e '104348833' -p xxx
Invalid value for last good epoch: '104348833'
Epoch number must be 'last' or between 109626381 and 104348833 inclusive
</pre>

<p>I have tried various values for the epoch, including the 2 mentioned values - always the same error message. Now my questions:<br />
1. The range is backwards, AHM &gt; LGE. Is that the reason for the (poor!) error message? Is it that my recovery epoch must be &gt;=AHM and &lt;=LGE, and therefore I don't have a chance of (normal) recovery here?<br />
2. Can someone come up with a hypothesis about what must have gone wrong to end up like that? As mentioned, the power loss affected the 3 nodes and the storage, but no disks were damaged. I thought the DB can always be recovered if the files that made it to the disk are unharmed ...</p>

<p>I know (after reading <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fsoftwaresupport.softwaregrp.com%2Fdoc%2FKM03449287">https://softwaresupport.softwaregrp.com/doc/KM03449287</a> ) that I can try to salvage table data, but more than 2000 projections are affected. As it is a test env I will just revert to an older snapshot - this post is only for my curiosity.<br />
Thank you for any insights!</p>
]]>
        </description>
    </item>
    <item>
        <title>Re-IP - Checking All IP Addresses when Changing Using Re-IP</title>
        <link>https://forum.vertica.com/discussion/241876/re-ip-checking-all-ip-addresses-when-changing-using-re-ip</link>
        <pubDate>Wed, 30 Sep 2020 14:20:02 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Amaksh</dc:creator>
        <guid isPermaLink="false">241876@/discussions</guid>
        <description><![CDATA[<p><a href="https://forum.vertica.com/profile/Hibiki" rel="nofollow">@Hibiki</a> provided this information.</p>

<p>When using the Re-IP tool, you need to perform some configuration steps to change any associated IP address. To learn more, see <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fkb%2FRe-IP%2FContent%2FFAQs%2FRe-IP.htm">https://www.vertica.com/kb/Re-IP/Content/FAQs/Re-IP.htm</a></p>
]]>
        </description>
    </item>
    <item>
        <title>Using Access Policies in Vertica to Hide Sensitive Data</title>
        <link>https://forum.vertica.com/discussion/241838/using-access-policies-in-vertica-to-hide-sensitive-data</link>
        <pubDate>Tue, 15 Sep 2020 14:37:57 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Amaksh</dc:creator>
        <guid isPermaLink="false">241838@/discussions</guid>
        <description><![CDATA[<p>[This information is provided by <a href="https://forum.vertica.com/profile/Ravi" rel="nofollow">@Ravi</a> ]</p>

<p>You  can use access policies in Vertica to show only limited data to users. We took an example of  Credit Card numbers and hid few characters to protect sensitive data.</p>

<p>Let us create a table with two database users and provide necessary permissions to those users.</p>

<pre spellcheck="false" tabindex="0">$ vsql -U dbadmin -w password 
dbadmin=&gt; DROP TABLE customers_table CASCADE;
dbadmin=&gt; CREATE TABLE customers_table  ( 
            ID      INT, 
            Name    VARCHAR(20), 
            CARDNUM VARCHAR(20)
          );
INSERT INTO customers_table VALUES ( 1, 'Tom','1234567809094321');
INSERT INTO customers_table VALUES ( 2, 'Jerry','4321567809096789');
COMMIT;

-- create users 
dbadmin=&gt; CREATE user mgr identified by 'password';
dbadmin=&gt; CREATE user opt identified by 'password';
dbadmin=&gt; GRANT USAGE ON SCHEMA public to mgr,opt;
dbadmin=&gt; GRANT SELECT on public.customers_table to mgr,opt;
-- create Roles and grant to users
dbadmin=&gt; CREATE ROLE manager;
dbadmin=&gt; CREATE ROLE operator;
dbadmin=&gt; grant manager to mgr;
dbadmin=&gt; grant operator to opt;
-- give default role operator to opt user only -- 
dbadmin=&gt; alter user opt default role operator;

-- create Colum level Access Policy 

dbadmin=&gt; CREATE ACCESS POLICY ON customers_table FOR COLUMN CARDNUM
    CASE
      WHEN ENABLED_ROLE('manager') THEN CARDNUM
      WHEN ENABLED_ROLE('operator') THEN 
          ( SUBSTR(CARDNUM, 1, 4)||'-XXXX-XXXX-'||SUBSTR(CARDNUM, 13, 4) )
      ELSE NULL
END ENABLE;

dbadmin=&gt; \q

-- Login again and see what dbadmin user can see. 
$ vsql -U dbadmin -w password 
dbadmin=&gt; SELECT * FROM  public.customers_table;
 ID | Name  | CARDNUM
----+-------+---------
  1 | Tom   |
  2 | Jerry |
(2 rows)
dbadmin=&gt; \q
</pre>

<p>Even the admin user dbadmin cannot see the full credit card number. Now, let us see what values are visible to user mgr:</p>

<pre spellcheck="false" tabindex="0">$ vsql -U mgr -w password
mgr=&gt;
mgr=&gt; SELECT * FROM  public.customers_table;
 ID | Name  | CARDNUM
----+-------+---------
  1 | Tom   |
  2 | Jerry |
(2 rows)
mgr=&gt; set role manager;
SET
mgr=&gt; SELECT * FROM  public.customers_table;
 ID | Name  |     CARDNUM
----+-------+------------------
  1 | Tom   | 1234567809094321
  2 | Jerry | 4321567809096789
(2 rows)

mgr=&gt; \q
</pre>

<p>Let us see what values are visible to user opt:</p>

<pre spellcheck="false" tabindex="0">$ Vsql -U opt -w password
opt=&gt;
opt=&gt; SELECT * FROM  public.customers_table;
 ID | Name  |       CARDNUM
----+-------+---------------------
  1 | Tom   | 1234-XXXX-XXXX-4321
  2 | Jerry | 4321-XXXX-XXXX-6789
(2 rows)

opt=&gt; \q
</pre>

<p>Depending on the roles, users can either see the full credit card number or masked data.</p>
]]>
        </description>
    </item>
    <item>
        <title>Database Storage - Raw and Compressed Size</title>
        <link>https://forum.vertica.com/discussion/239989/database-storage-raw-and-compressed-size</link>
        <pubDate>Mon, 08 Oct 2018 15:34:20 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">239989@/discussions</guid>
        <description><![CDATA[<p>One of the files generated by the /opt/vertica/scripts/collect_diag_dump.sh script details the raw and compressed size for every table in the Vertica database.</p>

<p>At the bottom of the report there is a “total” line that shows the database raw and compressed size!</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">[dbadmin@vertica8 ~]$ /opt/vertica/scripts/collect_diag_dump.sh -c -s false
Database Password:
Exporting profiling data........ Done
Exporting catalog and design.. Done
Computing compression  Done
Forming archive file  Done
Diagnostics dump available at ./diag_dump_20181008102602.tar.gz

[dbadmin@vertica8 ~]$ tar -xvzf ./diag_dump_20181008102602.tar.gz
tmp/Out_20181008102602/
tmp/Out_20181008102602/execution_engine_profiling_plans
tmp/Out_20181008102602/out_execution_engine_profiles
tmp/Out_20181008102602/out_dc_plans
tmp/Out_20181008102602/out_dc_plan_steps
tmp/Out_20181008102602/out_dc_plan_step_properties
tmp/Out_20181008102602/out_dc_plan_step_output_schema
tmp/Out_20181008102602/out_dc_plan_parents
tmp/Out_20181008102602/design
tmp/Out_20181008102602/planning_objects
tmp/Out_20181008102602/version
tmp/Out_20181008102602/compression

[dbadmin@vertica8 ~]$ cat tmp/Out_20181008102602/compression
                                TableName     PjCnt    PjType            RowCount         RawSize(MB)         Vertica(MB)         Compr.Ratio
=============================================================================================================================================
                              public.test         1         S           268435456              986.18              257.74                3.83
                   some_schema.some_table         1         S             4194304                8.00                0.02              400.00
_____________________________________________________________________________________________________________________________________________
                                    TOTAL                                                      994.18              257.76                3.86 
</pre>

<p><strong>Helpful links:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.1.x%2FHTML%2Findex.htm%23Authoring%2FAdministratorsGuide%2FDiagnostics%2FExportingProfilingData.htm">https://www.vertica.com/docs/9.1.x/HTML/index.htm#Authoring/AdministratorsGuide/Diagnostics/ExportingProfilingData.htm</a></p>

<p>Have fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>How to Create a Database with Desired Node Names</title>
        <link>https://forum.vertica.com/discussion/241788/how-to-create-a-database-with-desired-node-names</link>
        <pubDate>Thu, 27 Aug 2020 14:57:46 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Amaksh</dc:creator>
        <guid isPermaLink="false">241788@/discussions</guid>
        <description><![CDATA[<p>Tip by <strong>Mohit Saxena</strong></p>

<p>To be able to copy a cluster in Vertica, you must provide the same node name on the target. However, you might have nonsequential node names in the source database as in the following:</p>

<pre spellcheck="false" tabindex="0">$ admintools -t list_allnodes
Node              | Host           | State | Version          | DB
-------------------+----------------+-------+------------------+--------
v_prodee_node0004 | 192.168.51.201 | UP    | vertica-9.3.1.10 | prodee
v_prodee_node0005 | 192.168.51.202 | UP    | vertica-9.3.1.10 | prodee
v_prodee_node0006 | 192.168.51.203 | UP    | vertica-9.3.1.10 | prodee
</pre>

<p>In this case, you would need to create a database with the desired node names to copy a cluster.</p>

<p>To do this,</p>

<ol><li>Modify the following [nodes] section in admintools.conf  with the desired node names:</li>
</ol><pre spellcheck="false" tabindex="0">[nodes]
node0004 = 192.168.51.204,/home/dbadmin,/home/dbadmin
node0005 = 192.168.51.205,/home/dbadmin,/home/dbadmin
node0006 = 192.168.51.206,/home/dbadmin,/home/dbadmin
v_prodee_node0004 = 192.168.51.204,/home/dbadmin,/home/dbadmin
v_prodee_node0005 = 192.168.51.205,/home/dbadmin,/home/dbadmin
v_prodee_node0006 = 192.168.51.206,/home/dbadmin,/home/dbadmin

</pre>

<ol start="2"><li>Run the following create db command by providing node names in the hosts list:</li>
</ol><pre spellcheck="false" tabindex="0">$ admintools -t create_db -d prodee --compat21 -s v_prodee_node0004,v_prodee_node0005,v_prodee_node0006

Info: no password specified, using none
WARNING: --compat21 is deprecated as of Vertica. Support may be removed in future versions.
        Creating database prodee
</pre>

<ol start="3"><li>Check the database status.</li>
</ol><pre spellcheck="false" tabindex="0">$ admintools -t list_allnodes
Node              | Host           | State | Version          | DB
-------------------+----------------+-------+------------------+--------
v_prodee_node0004 | 192.168.51.204 | UP    | vertica-9.3.1.10 | prodee
v_prodee_node0005 | 192.168.51.205 | UP    | vertica-9.3.1.10 | prodee
v_prodee_node0006 | 192.168.51.206 | UP    | vertica-9.3.1.10 | prodee

</pre>
]]>
        </description>
    </item>
    <item>
        <title>Enable \timing from the vsql Command Line</title>
        <link>https://forum.vertica.com/discussion/239543/enable-timing-from-the-vsql-command-line</link>
        <pubDate>Tue, 20 Mar 2018 15:35:55 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>[Deleted User]</dc:creator>
        <guid isPermaLink="false">239543@/discussions</guid>
        <description><![CDATA[<p>This tip was authored by Jim Knicely</p>

<p>The vsql \timing meta-command reports, in milliseconds, the length of time it takes each SQL statement to execute.</p>

<p>Example:</p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; \timing
Timing is on.

dbadmin=&gt; SELECT COUNT(*) FROM big_varchar_table WHERE pk BETWEEN 1000000 AND 2000000;
  COUNT
---------
1000001
(1 row)
Time: First fetch (1 row): 179.609 ms. All rows formatted: 179.691 ms
</pre>

<p>You can also enable \timing from the command line using the vsql -i command.</p>

<p>Example:</p>

<pre spellcheck="false" tabindex="0">[dbadmin@s18384357 ~]$ vsql -ic "SELECT COUNT(*) FROM big_varchar_table WHERE pk BETWEEN 1000000 AND 2000000;"
  COUNT
---------
1000001
(1 row)
Time: First fetch (1 row): 52.728 ms. All rows formatted: 52.881 ms
</pre>

<p>Have Fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>How to know what is killing Vertica process</title>
        <link>https://forum.vertica.com/discussion/241701/how-to-know-what-is-killing-vertica-process</link>
        <pubDate>Fri, 26 Jun 2020 15:31:02 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Amaksh</dc:creator>
        <guid isPermaLink="false">241701@/discussions</guid>
        <description><![CDATA[<p><strong>This information was provided by Hibiki Serizawa</strong></p>

<p>Vertica handles the SIGSEGV signal (segmentation fault) well by logging the information to vertica.log, ErrorReport.txt, and the core dump files. If Vertica is killed with the SIGKILL signal such as kill -9, there is no information in any of the log files (in Vertica or system side). Additionally, there is no information even if Vertica receives SIGSEGV signal. In this case, you need to capture the signal information on system side.</p>

<p>Following are two ways to capture this information, auditd and SystemTap.</p>

<p><strong>auditd (Linux Auditing System)</strong><br />
The audit daemon writes audit records to the disk. It captures all system audit events including system calls and watches the file system objects. To capture the specific system calls, you need to configure auditd. auditd records any process that ends abnormally without additional configuration as the event is one of the system audit events.</p>

<p>To enable auditd to capture kill system call, run the following commands after starting up the auditd daemon:</p>

<pre spellcheck="false" tabindex="0">$ auditctl -a exit,always -F arch=b64 -S kill -k audit_kill
$ auditctl -a exit,always -F arch=b64 -S tkill -k audit_kill
$ auditctl -a exit,always -F arch=b64 -S tgkill -k audit_kill
</pre>

<p>These configurations are temporary and exist only until restarting auditd or rebooting the system. To configure permanently, add the following lines to /etc/audit/audit.rules and restart auditd:</p>

<pre spellcheck="false" tabindex="0">-a exit,always -F arch=b64 -S kill -k audit_kill
-a exit,always -F arch=b64 -S tkill -k audit_kill
-a exit,always -F arch=b64 -S tgkill -k audit_kill
</pre>

<p>Run the following commands to list the current configuration:</p>

<pre spellcheck="false" tabindex="0">$ auditctl -l
-a always,exit -F arch=b64 -S kill -F key=audit_kill
-a always,exit -F arch=b64 -S tkill -F key=audit_kill
-a always,exit -F arch=b64 -S tgkill -F key=audit_kill
</pre>

<p>In the this example, 'audit_kill' is specified as the value of -k option. This is the filter key that can be used to search the audit records later.</p>

<p>Try to kill the Vertica process after enabling auditd to capture the kill system call:</p>

<pre spellcheck="false" tabindex="0">$ killall -9 vertica

$ tail -f /var/log/audit/audit.log
type=SYSCALL msg=audit(1592901047.912:529): arch=c000003e syscall=62 success=yes exit=0 a0=f66 a1=9 a2=0 a3=22d items=0 ppid=4172 pid=4173 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="killall" exe="/usr/bin/killall" key="audit_kill"
type=OBJ_PID msg=audit(1592901047.912:529): opid=3942 oauid=1000 ouid=1001 oses=1 ocomm="vertica"
type=PROCTITLE msg=audit(1592901047.912:529): proctitle=6B696C6C616C6C002D390076657274696361
</pre>

<p>Search the audit records by using the filter key:</p>

<pre spellcheck="false" tabindex="0">$ ausearch -i -k audit_kill
----
type=PROCTITLE msg=audit(06/23/2020 17:30:47.912:529) : proctitle=killall -9 vertica
type=OBJ_PID msg=audit(06/23/2020 17:30:47.912:529) : opid=3942 oauid=duser ouid=dbadmin oses=1 ocomm=vertica
type=SYSCALL msg=audit(06/23/2020 17:30:47.912:529) : arch=x86_64 syscall=kill success=yes exit=0 a0=0xf66 a1=SIGKILL a2=0x0 a3=0x22d items=0 ppid=4172 pid=4173 auid=duser uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=1 comm=killall exe=/usr/bin/killall key=audit_kill
</pre>

<p>This outputenables you to figure out that /usr/bin/killall sent SIGKILL signal successfully to the Vertica process with PID 3942.</p>

<p>With the default configuration for auditd, the log file is rotated. If you want to search the records in the rotated files, use -if/--input option as in the following:</p>

<p><code spellcheck="false" tabindex="0">$ ausearch -i -k audit_kill -if /var/log/audit/audit.log.1</code></p>

<p>To search audit records for the process that ended abnormally, run the following command:</p>

<pre spellcheck="false" tabindex="0">$ ausearch -i -m ANOM_ABEND
----
type=ANOM_ABEND msg=audit(06/22/2020 18:26:21.915:8331836) : auid=dbadmin uid=dbadmin gid=verticadba ses=458 pid=32595 comm=rdk:main exe=/opt/vertica/bin/vertica sig=SIGSEGV res=yes
</pre>

<p>This output enables you to figure out that the Vertica process was ended by the SIGSEGV signal and the segmentation fault is associated with rdk:main.</p>

<p>In most cases, auditd is installed by default. If not, install the audit package for RHEL/CentOS/SUSE or the auditd package for Debian/Ubuntu.</p>

<p><strong>SystemTap</strong></p>

<p>SystemTap is a tracing and probing tool that allows you to monitor the activities of the operating system by simply running user-written SystemTap scripts.</p>

<p>Install the following packages:</p>

<p>•   systemtap<br />
•   systemtap-runtime</p>

<p>Additionally, you need to install the following packages to get information about the kernel. These packages must be for your kernel version.</p>

<p>•   kernel-debuginfo<br />
•   kernel-debuginfo-common<br />
•   kernel-devel</p>

<p>To determine what kernel version your system is currently using, run the following command:</p>

<pre spellcheck="false" tabindex="0">$ uname -r
3.10.0-1062.12.1.el7.x86_64
</pre>

<p>For example, if your kernel version is 3.10.0-1062.12.1.el7.x86_64, then you need to install the following RPMs:</p>

<p>kernel-debuginfo-3.10.0-1062.12.1.el7.x86_64.rpm<br />
kernel-debuginfo-common-x86_64-3.10.0-1062.12.1.el7.x86_64.rpm<br />
kernel-devel-3.10.0-1062.12.1.el7.x86_64.rpm</p>

<p>In case the kernel version is not the latest, these RPMs may not exist in the repository and you may need to install them manually. The following RPMs are for CentOS 7.7:</p>

<p><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=http%3A%2F%2Fdebuginfo.centos.org%2F7%2Fx86_64%2Fkernel-debuginfo-3.10.0-1062.12.1.el7.x86_64.rpm">http://debuginfo.centos.org/7/x86_64/kernel-debuginfo-3.10.0-1062.12.1.el7.x86_64.rpm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=http%3A%2F%2Fdebuginfo.centos.org%2F7%2Fx86_64%2Fkernel-debuginfo-common-x86_64-3.10.0-1062.12.1.el7.x86_64.rpm">http://debuginfo.centos.org/7/x86_64/kernel-debuginfo-common-x86_64-3.10.0-1062.12.1.el7.x86_64.rpm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=http%3A%2F%2Fvault.centos.org%2F7.7.1908%2Fupdates%2Fx86_64%2FPackages%2Fkernel-devel-3.10.0-1062.12.1.el7.x86_64.rpm">http://vault.centos.org/7.7.1908/updates/x86_64/Packages/kernel-devel-3.10.0-1062.12.1.el7.x86_64.rpm</a></p>

<p>For Ubuntu, refer to<a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwiki.ubuntu.com%2FKernel%2FSystemtap"> https://wiki.ubuntu.com/Kernel/Systemtap</a>. <br />
For Debian, refer to <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwiki.debian.org%2FDebugPackage">https://wiki.debian.org/DebugPackage</a>.</p>

<p>Create the SystemTap script as in the following to capture the signal sent to the specific process:</p>

<pre spellcheck="false" tabindex="0"> #! /usr/bin/env stap

#
# sigmon.stp for capturing the signals.
#

probe begin
{
  printf("%-8s %-16s %-5s %-16s %6s %-16s\n",
         "SPID", "SNAME", "RPID", "RNAME", "SIGNUM", "SIGNAME")
}

probe signal.send 
{
  if (sig_pid == target())
    printf("%-8d %-16s %-5d %-16s %-6d %-16s\n", 
           pid(), execname(), sig_pid, pid_name, sig, sig_name)
}
</pre>

<p>Run SystemTap with the above script in the background by providing Vertica process ID.</p>

<p><code spellcheck="false" tabindex="0">$ nohup stap -x `pgrep -o vertica` /tmp/sigmon.stp &gt; /tmp/sigmon.log 2&gt;&amp;1 &amp;</code></p>

<p>Try to kill the Vertica process after running SystemTap script:</p>

<pre spellcheck="false" tabindex="0">$ killall -9 vertica

$ tail -f /tmp/sigmon.log
SPID     SNAME            RPID  RNAME            SIGNUM SIGNAME
9707     killall          6555  vertica          9      SIGKILL
</pre>

<p>This output enables you to figure that killall sent SIGKILL signal to the Vertica process with PID 6555.</p>
]]>
        </description>
    </item>
    <item>
        <title>How to delete the oldest partition?</title>
        <link>https://forum.vertica.com/discussion/241631/how-to-delete-the-oldest-partition</link>
        <pubDate>Thu, 28 May 2020 22:37:45 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>mosheg</dc:creator>
        <guid isPermaLink="false">241631@/discussions</guid>
        <description><![CDATA[<p>When you need to drop the oldest partition consider the following example:</p>

<pre spellcheck="false" tabindex="0">CREATE TABLE public.my_table
(
    order_no int,
    order_date timestamp NOT NULL,
    shipper varchar(20),
    ship_date date
)
PARTITION BY DATE(order_date);

\set DEMO_ROWS 10

INSERT INTO public.my_table
WITH myrows AS (SELECT
row_number() over()    AS order_no,
NOW() - RANDOMINT(30) AS order_date
FROM ( SELECT 1 FROM ( SELECT NOW() as se union all
SELECT NOW() + :DEMO_ROWS - 1 AS se) a timeseries ts AS '1 day' OVER (ORDER BY se)) b)
SELECT order_no, order_date, 'something', order_date AS ship_date
FROM myrows
ORDER BY order_no;
COMMIT;

WITH my_list AS
(SELECT max(order_date) as oldest from public.my_table)
SELECT date(order_date),
       CASE WHEN order_date = oldest THEN 'Will be droped' ELSE 'Will keep' END as Status
FROM public.my_table, my_list ORDER BY 1;

-- Option A:
\set OLDEST `vsql -XAtc "SELECT max(order_date)::date from public.my_table;"`
\set OLDEST '''':OLDEST''''
SELECT DROP_PARTITIONS ('my_table', :OLDEST, :OLDEST);

SELECT DATE(order_date) FROM public.my_table ORDER BY 1;

-- Option B:
WITH my_list AS
(SELECT max(order_date) as oldest from public.my_table)
SELECT date(order_date),
       CASE WHEN order_date = oldest THEN 'Will be droped' ELSE 'Will keep' END as Status
FROM public.my_table, my_list ORDER BY 1;

CREATE OR REPLACE FUNCTION my_drop(d2d DATE) RETURN VARCHAR(100)
   AS BEGIN
     RETURN 'SELECT DROP_PARTITIONS (''my_table'', ''' || d2d || ''' , ''' || d2d || ''');';
   END;

\t
\o | vsql
SELECT my_drop((SELECT max(order_date)::DATE from public.my_table));
\o
\t

SELECT DATE(order_date) FROM public.my_table ORDER BY 1;
</pre>

<p>Here is the run time output:</p>

<pre spellcheck="false" tabindex="0">CREATE TABLE public.my_table
(
    order_no int,
    order_date timestamp NOT NULL,
    shipper varchar(20),
    ship_date date
)
PARTITION BY DATE(order_date);
CREATE TABLE
INSERT INTO public.my_table
WITH myrows AS (SELECT
row_number() over()    AS order_no,
NOW() - RANDOMINT(30) AS order_date
FROM ( SELECT 1 FROM ( SELECT NOW() as se union all
SELECT NOW() + 10 - 1 AS se) a timeseries ts AS '1 day' OVER (ORDER BY se)) b)
SELECT order_no, order_date, 'something', order_date AS ship_date
FROM myrows
ORDER BY order_no;
 OUTPUT
--------
     10
(1 row)

COMMIT;
COMMIT

WITH my_list AS
(SELECT max(order_date) as oldest from public.my_table)
SELECT date(order_date),
       CASE WHEN order_date = oldest THEN 'Will be droped' ELSE 'Will keep' END as Status
FROM public.my_table, my_list ORDER BY 1;
    date    |     Status
------------+----------------
 2020-05-01 | Will keep
 2020-05-02 | Will keep
 2020-05-06 | Will keep
 2020-05-07 | Will keep
 2020-05-07 | Will keep
 2020-05-10 | Will keep
 2020-05-13 | Will keep
 2020-05-20 | Will keep
 2020-05-22 | Will keep
 2020-05-24 | Will be droped
(10 rows)

SELECT DROP_PARTITIONS ('my_table', '2020-05-24', '2020-05-24');
  DROP_PARTITIONS
-------------------
 Partition dropped
(1 row)

SELECT DATE(order_date) FROM public.my_table ORDER BY 1;
    DATE
------------
 2020-05-01
 2020-05-02
 2020-05-06
 2020-05-07
 2020-05-07
 2020-05-10
 2020-05-13
 2020-05-20
 2020-05-22
(9 rows)

WITH my_list AS
(SELECT max(order_date) as oldest from public.my_table)
SELECT date(order_date),
       CASE WHEN order_date = oldest THEN 'Will be droped' ELSE 'Will keep' END as Status
FROM public.my_table, my_list ORDER BY 1;
    date    |     Status
------------+----------------
 2020-05-01 | Will keep
 2020-05-02 | Will keep
 2020-05-06 | Will keep
 2020-05-07 | Will keep
 2020-05-07 | Will keep
 2020-05-10 | Will keep
 2020-05-13 | Will keep
 2020-05-20 | Will keep
 2020-05-22 | Will be droped
(9 rows)

CREATE OR REPLACE FUNCTION my_drop(d2d DATE) RETURN VARCHAR(100)
   AS BEGIN
     RETURN 'SELECT DROP_PARTITIONS (''my_table'', ''' || d2d || ''' , ''' || d2d || ''');';
   END;
CREATE FUNCTION

Showing only tuples.
SELECT my_drop((SELECT max(order_date)::DATE from public.my_table));
  DROP_PARTITIONS
-------------------
 Partition dropped
(1 row)

Tuples only is off.
SELECT DATE(order_date) FROM public.my_table ORDER BY 1;
    DATE
------------
 2020-05-01
 2020-05-02
 2020-05-06
 2020-05-07
 2020-05-07
 2020-05-10
 2020-05-13
 2020-05-20
(8 rows)
</pre>
]]>
        </description>
    </item>
    <item>
        <title>Replacing the Host With New IP Address</title>
        <link>https://forum.vertica.com/discussion/241583/replacing-the-host-with-new-ip-address</link>
        <pubDate>Mon, 11 May 2020 15:48:49 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Amaksh</dc:creator>
        <guid isPermaLink="false">241583@/discussions</guid>
        <description><![CDATA[<p>If you are using Vertica 9.3 and higher or both the nodes are reachable, follow these steps to replace your host in the Vertica Documentation:</p>

<p><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FAdministratorsGuide%2FManageNodes%2FReplacingANodeUsingTheSameNameAndIPAddress.htm%3Ftocpath%3DAdministrator%2527s%2520Guide%257CManaging%2520the%2520Database%257CManaging%2520Nodes%257CReplacing%2520Nodes%257C_____1">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AdministratorsGuide/ManageNodes/ReplacingANodeUsingTheSameNameAndIPAddress.htm?tocpath=Administrator%27s%20Guide%7CManaging%20the%20Database%7CManaging%20Nodes%7CReplacing%20Nodes%7C_____1</a></p>

<p>If you are using a version prior to 9.3 and the node with the old IP address is not reachable, follow these steps to replace the host with the new IP address. In these steps we have used dbadmin user as the database administrator. If you have a different user for database administrator, edit the script accordingly and pass –u  to install_vertica command in step 6.</p>

<ol><li>Login to the database and run the following command:<br />
•   <code spellcheck="false" tabindex="0">ALTER NODE &lt;failed Node name&gt; hostname '&lt;NEW_IPADDRESS&gt;' control hostname '&lt;NEW_IPADDRESS&gt;'</code>; <br />
•   <code spellcheck="false" tabindex="0">Select reload_spread(true);</code></li>
<li>Replace the old_ipaddress with new_ipaddress in /opt/vertica/config/admintools.conf file on a good node. Use configuration options to distribute admintools.conf file to all nodes in the cluster.</li>
<li>Login to the new host as root.</li>
<li>Run <code spellcheck="false" tabindex="0">“id dbadmin”</code> to verify dbadmin user exists. If not, create the user with verticadba as a primary group.</li>
<li>Install the vertica rpm using<code spellcheck="false" tabindex="0">rpm -Uvh verticaxxx.rpm</code>. (preferably place the rpm in /tmp location)</li>
<li>Execute <code spellcheck="false" tabindex="0">install_vertica -s locahost -r /tmp/verticaxx.rpm</code>. This step fixes the file permission on folders in /opt/vertica directory.</li>
<li>Switch to dbadmin user by running <code spellcheck="false" tabindex="0">“su – dbadmin”</code>.</li>
<li>SSH to any other host in the cluster as dbadmin. If passwordless SSH is not setup, copy the following three files from any other node to the ~/.ssh/ folder and ensure permissions are identical to other nodes:<br />
a.  ~/.ssh/id_rsa<br />
b.  ~/.ssh/id_rsa.pub <br />
c.  ~/.ssh/ authorized_keys</li>
<li>Once the passwordless SSH is fixed, ensure you are able to connect to and from other hosts in the cluster.</li>
<li>On a good host open admintools and use configuration options to distribute admintools.conf file and database configuration file to all nodes in the cluster.</li>
<li>Get a list of data, catalog, and other storage locations if any exist by running the following query:<br /><code spellcheck="false" tabindex="0">select storage_path, storage_usage  from disk_storage where node_name ilike '&lt;down node name&gt;';</code></li>
<li>Connect to the new host as dbadmin and create directories using the output from the above query <code spellcheck="false" tabindex="0">“mkdir -p storage_path”</code> . <br /><em><strong>Note</strong>: Ensure permissions and ownership of these directories match other nodes.</em></li>
<li>From a good host, use admintools command line to restart the node that is down with force flag:<br /><code spellcheck="false" tabindex="0">/opt/vertica/bin/admintools -t restart_node -d dbname -s down_node_ipaddress -F</code></li>
</ol>]]>
        </description>
    </item>
    <item>
        <title>Rebuilding the Host With the Same IP Address</title>
        <link>https://forum.vertica.com/discussion/241582/rebuilding-the-host-with-the-same-ip-address</link>
        <pubDate>Mon, 11 May 2020 15:48:21 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Amaksh</dc:creator>
        <guid isPermaLink="false">241582@/discussions</guid>
        <description><![CDATA[<p>If you want to rebuild your existing node due to a disk or hardware failure, follow these steps to replace the node with the same IP address. In these steps we have used dbadmin user as the database administrator. If you have a different user for database administrator, edit the script accordingly and pass –u  to install_vertica command in step 4.</p>

<ol><li>Login to the new host as root.</li>
<li>Run <code spellcheck="false" tabindex="0">“id dbadmin”</code> to verify dbadmin user exists. If not, create the user with verticadba as a primary group.</li>
<li>Install the vertica rpm using <code spellcheck="false" tabindex="0">rpm -Uvh verticaxxx.rpm</code>. (preferably place the rpm in /tmp location)</li>
<li>Execute<code spellcheck="false" tabindex="0">install_vertica -s locahost -r /tmp/verticaxx.rpm</code>. This step fixes the file permission on folders in /opt/vertica directory.</li>
<li>Switch to dbadmin user by running <code spellcheck="false" tabindex="0">“su – dbadmin”</code>.</li>
<li>SSH to any other host in the cluster as dbadmin. If passwordless SSH is not setup, copy the following three files from any other node to the ~/.ssh/ folder and ensure permissions are identical to other nodes:<br />
a.  ~/.ssh/id_rsa<br />
b.  ~/.ssh/id_rsa.pub <br />
c.  ~/.ssh/ authorized_keys</li>
<li>Once the passwordless SSH is fixed, ensure you are able to connect to and from other hosts in the cluster.</li>
<li>On a good host open admintools and use configuration options to distribute admintools.conf file and database configuration file to all nodes in the cluster.</li>
<li>Get a list of data, catalog, and other storage locations if any exist by running the following query:<br /><code spellcheck="false" tabindex="0">select storage_path, storage_usage  from disk_storage where node_name ilike '&lt;down node name&gt;';</code></li>
<li>Connect to the new host as dbadmin and create directories using the output from the above query <code spellcheck="false" tabindex="0">“mkdir -p storage_path”</code> . <br /><em><strong>Note</strong>: Ensure permissions and ownership of these directories match other nodes.</em></li>
<li>From a good host, use admintools command line to restart the node that is down with force flag:<br /><code spellcheck="false" tabindex="0">/opt/vertica/bin/admintools -t restart_node -d dbname -s down_node_ipaddress -F</code></li>
</ol>]]>
        </description>
    </item>
    <item>
        <title>Checking the Validity of a Table Audit</title>
        <link>https://forum.vertica.com/discussion/240032/checking-the-validity-of-a-table-audit</link>
        <pubDate>Thu, 18 Oct 2018 17:46:29 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">240032@/discussions</guid>
        <description><![CDATA[<p>The Vertica AUDIT function can be used to estimate the raw data size of a database, schema, or table.</p>

<p>Ever wonder if it’s accurate? A simple test shows that it is 100 percent accurate if you specify an error tolerance of 0 and a confidence level of 100.</p>

<p><strong>Example:</strong></p>

<p>First let’s audit the table BIG_TABLE.</p>

<pre spellcheck="false" tabindex="0">[dbadmin@s18384357 ~]$ /opt/vertica/bin/vsql -c "SELECT audit('public.big_table', 0, 100);"
  audit
----------
10696205
(1 row)
</pre>

<p>Next extract the data from the table to a file, eliminating all field separators and record terminators as Vertica does not include those bytes in the audit.</p>

<p><code spellcheck="false" tabindex="0">[dbadmin@s18384357 ~]$ /opt/vertica/bin/vsql -o /home/dbadmin/big_table.out -F '' -R '' -At -c "SELECT * FROM public.big_table;" -q</code></p>

<p>Here is the exported file size:</p>

<pre spellcheck="false" tabindex="0">[dbadmin@s18384357 ~]$ stat -c %s /home/dbadmin/big_table.out
10696206
</pre>

<p>Wait a second! Why is the output file size 1 byte bigger than the result of the Vertica AUDIT function? It’s because there is a training new line character in the file. Let’s get rid of it!</p>

<pre spellcheck="false" tabindex="0">[dbadmin@s18384357 ~]$ printf %s "$(&lt; /home/dbadmin/big_table.out)" &gt; /home/dbadmin/big_table_no_trailing_nl.out

[dbadmin@s18384357 ~]$ stat -c %s /home/dbadmin/big_table_no_trailing_nl.out
10696205
</pre>

<p>Now we are 100% accurate!</p>

<p><strong>Helpful Links:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.1.x%2FHTML%2Findex.htm%23Authoring%2FSQLReferenceManual%2FFunctions%2FVerticaFunctions%2FLicenseManagement%2FAUDIT.htm">https://www.vertica.com/docs/9.1.x/HTML/index.htm#Authoring/SQLReferenceManual/Functions/VerticaFunctions/LicenseManagement/AUDIT.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.1.x%2FHTML%2Findex.htm%23Authoring%2FAdministratorsGuide%2FLicensing%2FCalculatingTheDatabaseSize.htm">https://www.vertica.com/docs/9.1.x/HTML/index.htm#Authoring/AdministratorsGuide/Licensing/CalculatingTheDatabaseSize.htm</a></p>

<p>Have fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>Vertica tip: are your columns too wide?</title>
        <link>https://forum.vertica.com/discussion/241091/vertica-tip-are-your-columns-too-wide</link>
        <pubDate>Wed, 13 Nov 2019 16:20:02 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Bryan_H</dc:creator>
        <guid isPermaLink="false">241091@/discussions</guid>
        <description><![CDATA[<p>This tip expands on the earlier post on encoding and compression at <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fblog%2Fchecking-and-improving-column-compression-and-encoding%2F">https://www.vertica.com/blog/checking-and-improving-column-compression-and-encoding/</a></p>

<p>When you have millions to billions of rows, data type becomes a bit more important: even an extra 10 bytes per row across a huge data set will impact storage or performance (or both!).</p>

<p>When I created the big_fact_table, I included some VARCHAR fields, but failed to set a width.  Vertica defaults to VARCHAR(80) in this case.  However, all of my strings are 8-character alpahnumerics, so why have VARCHAR(80) when VARCHAR(10) will suffice?  I created a new table named "varchar10" with the same fields but altered the VARCHAR fields to VARCHAR(10) with ALTER TABLE...ALTER COLUMN...SET DATA TYPE VARCHAR(10).</p>

<p>This had almost no impact on table size thanks to compression and encoding:</p>

<blockquote><div>
  <p>dbadmin=&gt; select anchor_table_name, projection_name, used_bytes from projection_storage where anchor_table_name like 'big_fact_table%' limit 5;<br />
        anchor_table_name      |             projection_name             | used_bytes<br />
  -----------------------------+-----------------------------------------+------------<br />
   big_fact_table              | big_fact_table_super                    | 6843970195<br />
   big_fact_table_varchar10    | big_fact_table_varchar10_super          | 6843968398</p>
</div></blockquote>

<p>BUT, when I load data with INSERT...SELECT, I see a significant performance improvement with the smaller VARCHAR:</p>

<blockquote><div>
  <p>dbadmin=&gt; insert into public.big_fact_table select * from public.big1090;</p>
  
  <h2 data-id="output">  OUTPUT</h2>
  
  <p>445580312<br />
  (1 row)<br />
  Time: First fetch (1 row): 380333.748 ms. All rows formatted: 380333.823 ms<br />
  dbadmin=&gt; insert into public.big_fact_table_varchar10 select * from public.big1090;</p>
  
  <h2 data-id="output-1">  OUTPUT</h2>
  
  <p>445580312<br />
  (1 row)<br />
  Time: First fetch (1 row): 269333.788 ms. All rows formatted: 269333.864 ms</p>
</div></blockquote>

<p>That is around 25% faster!  Why?  During load and query, Vertica must allocate enough resources assuming the fields will actually contain the full data size.  If you allocate too much memory, this will slow down sorts, segmentation, and so on as Vertica needs to move around data types that have lots of empty space.  So optimizing data type and length helps Vertica optimize memory usage and run faster!</p>

<p>You can check whether you've allocated too much space in a VARCHAR or VARBINARY with SELECT MAX(LENGTH(&lt;column_name&gt;)) FROM &lt;table_name&gt;;  and compare to the column DDL.</p>

<p>For more info and limitations: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FAdministratorsGuide%2FTables%2FColumnManagement%2FReduceColumnWidth.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AdministratorsGuide/Tables/ColumnManagement/ReduceColumnWidth.htm</a></p>
]]>
        </description>
    </item>
    <item>
        <title>Define a Vertica Flattened Table Column as Having Both DEFAULT and  SET USING Constraints</title>
        <link>https://forum.vertica.com/discussion/241201/define-a-vertica-flattened-table-column-as-having-both-default-and-set-using-constraints</link>
        <pubDate>Wed, 29 Jan 2020 19:25:00 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">241201@/discussions</guid>
        <description><![CDATA[<p>Columns in a flattened table can query other tables with constraints DEFAULT and  SET USING .</p>

<p>Vertica executes DEFAULT queries only on new rows when they are added to the flattened table, through load operations such as INSERT and COPY. Thereafter, changes in the original data sources have no effect on the flattened table.</p>

<p>Vertica executes SET USING queries only when you invoke the function REFRESH_COLUMNS. Load operations set SET USING columns in new rows to NULL. After the load, you must call REFRESH_COLUMNS to populate these columns from the queried tables. This can be useful in two ways: you can defer the overhead of updating the flattened table to any time that is convenient; and you can repeatedly query source tables for new data.</p>

<p>A flattened table column is not limited to having either a DEFAULT or SET USING constraint. It can have both constriants!</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; CREATE TABLE customer_dim (customer_id INT, customer_name VARCHAR(100));
CREATE TABLE

dbadmin=&gt; INSERT INTO customer_dim SELECT 1, 'LUKE';
 OUTPUT
--------
      1
(1 row)

dbadmin=&gt; INSERT  NTO customer_dim SELECT 2, 'HAN';
 OUTPUT
--------
      1
(1 row)

dbadmin=&gt; INSERT INTO customer_dim SELECT 3, 'LANDO';
 OUTPUT
--------
      1
(1 row)

dbadmin=&gt; CREATE TABLE customer_fact (pk INT, customer_id INT, customer_name VARCHAR(100) DEFAULT USING (SELECT customer_name FROM customer_dim WHERE customer_id = customer_fact.customer_id));
CREATE TABLE

dbadmin=&gt; INSERT INTO customer_fact (pk, customer_id) SELECT 1, 2;
 OUTPUT
--------
      1
(1 row)

dbadmin=&gt; INSERT INTO customer_fact (pk, customer_id) SELECT 2, 1;
 OUTPUT
--------
      1
(1 row)

dbadmin=&gt; SELECT * FROM customer_fact;
 pk | customer_id | customer_name
----+-------------+---------------
  1 |           2 | HAN
  2 |           1 | LUKE
(2 rows)


dbadmin=&gt; UPDATE customer_dim SET customer_name = 'BEN' WHERE customer_id = 1;
 OUTPUT
--------
      1
(1 row)

dbadmin=&gt; SELECT refresh_columns('customer_fact', 'customer_name', 'UPDATE'); COMMIT;
      refresh_columns
---------------------------
 refresh_columns completed
(1 row)

COMMIT

dbadmin=&gt; SELECT * FROM customer_fact;
 pk | customer_id | customer_name
----+-------------+---------------
  1 |           2 | HAN
  2 |           1 | BEN
(2 rows)
</pre>

<p><strong>Useful  Links:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FAnalyzingData%2FFlattenedTables%2FFlattenedTables.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AnalyzingData/FlattenedTables/FlattenedTables.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FAnalyzingData%2FFlattenedTables%2FSetUsingVersusDefault.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AnalyzingData/FlattenedTables/SetUsingVersusDefault.htm</a></p>

<p>Have Fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>Loading ZIP code boundaries from a shapefile in three easy steps!</title>
        <link>https://forum.vertica.com/discussion/241200/loading-zip-code-boundaries-from-a-shapefile-in-three-easy-steps</link>
        <pubDate>Wed, 29 Jan 2020 00:05:38 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Bryan_H</dc:creator>
        <guid isPermaLink="false">241200@/discussions</guid>
        <description><![CDATA[<p>Are you working on a project where you'd like to classify position data into geographic region?  The US Census Bureau provides shapefiles for ZIP code tracts that you can ingest into Vertica and use to identify the ZIP code for given coordinates.  In this exercise, we'll load the shapefile into Vertica, examine the contents, and try matching corrdinates to a ZIP code.</p>

<p>Here is the shapefile source: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.census.gov%2Fgeographies%2Fmapping-files%2Ftime-series%2Fgeo%2Fcarto-boundary-file.html">https://www.census.gov/geographies/mapping-files/time-series/geo/carto-boundary-file.html</a></p>

<p>Obtain the file for ZIP Code Tabulation Areas (ZCTAs): cb_2018_us_zcta510_500k.zip   [59 MB] (2018 file shown; you can use a newer year, if available)</p>

<p>I unpacked the shapefile download to /data1/bryan/geo/</p>

<p>Listing:</p>

<blockquote><div>
  <p>-rw-rw---- 1 bryan bryan      165 Apr 15  2019 cb_2018_us_zcta510_500k.prj<br />
  -rw-rw---- 1 bryan bryan        5 Apr 15  2019 cb_2018_us_zcta510_500k.cpg<br />
  -rw-rw---- 1 bryan bryan   265252 Apr 15  2019 cb_2018_us_zcta510_500k.shx<br />
  -rw-rw---- 1 bryan bryan 91072224 Apr 15  2019 cb_2018_us_zcta510_500k.shp<br />
  -rw-rw---- 1 bryan bryan  1756826 Apr 15  2019 cb_2018_us_zcta510_500k.dbf<br />
  -rwxrwxrwx 1 bryan bryan    34290 Apr 15  2019 cb_2018_us_zcta510_500k.shp.iso.xml<br />
  -rwxrwxrwx 1 bryan bryan     9052 Apr 15  2019 cb_2018_us_zcta510_500k.shp.ea.iso.xml</p>
</div></blockquote>

<p>Be sure to chmod or chown files so they are readable by Vertica!</p>

<p>Follow the documentation: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FAnalyzingData%2FGeospatial%2FGeospatialAnalytics%2FLoadingSpatialDataFromShapefiles.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AnalyzingData/Geospatial/GeospatialAnalytics/LoadingSpatialDataFromShapefiles.htm</a></p>

<p>Step 1: Use STV_ShpCreateTable to generate a CREATE TABLE statement.</p>

<blockquote><div>
  <p>dbadmin=&gt; SELECT STV_ShpCreateTable ( USING PARAMETERS file = '/data1/bryan/geo/cb_2018_us_zcta510_500k.shp') OVER() AS zcta;</p>
  
  <h2 data-id="zcta">                 zcta</h2>
  
  <p>CREATE TABLE cb_2018_us_zcta510_500k(<br />
     gid IDENTITY(64) PRIMARY KEY,<br />
     ZCTA5CE10 VARCHAR(5),<br />
     AFFGEOID10 VARCHAR(14),<br />
     GEOID10 VARCHAR(5),<br />
     ALAND10 INT8,<br />
     AWATER10 INT8,<br />
     geom GEOMETRY(99582)<br />
   );<br />
  (9 rows)</p>
</div></blockquote>

<p>Step 2: Create the table.</p>

<blockquote><div>
  <p>dbadmin=&gt;  CREATE TABLE cb_2018_us_zcta510_500k(<br />
  dbadmin(&gt;    gid IDENTITY(64) PRIMARY KEY,<br />
  dbadmin(&gt;    ZCTA5CE10 VARCHAR(5),<br />
  dbadmin(&gt;    AFFGEOID10 VARCHAR(14),<br />
  dbadmin(&gt;    GEOID10 VARCHAR(5),<br />
  dbadmin(&gt;    ALAND10 INT8,<br />
  dbadmin(&gt;    AWATER10 INT8,<br />
  dbadmin(&gt;    geom GEOMETRY(99582)<br />
  dbadmin(&gt;  );<br />
  CREATE TABLE</p>
</div></blockquote>

<p>Step 3: Load the shapefile.</p>

<blockquote><div>
  <p>dbadmin=&gt; COPY cb_2018_us_zcta510_500k WITH SOURCE STV_ShpSource(file='/data1/bryan/geo/cb_2018_us_zcta510_500k.shp') PARSER STV_ShpParser();</p>
  
  <h2 data-id="rows-loaded"> Rows Loaded</h2>

<pre spellcheck="false" tabindex="0">   33144
</pre>
  
  <p>(1 row)</p>
</div></blockquote>

<p>That was quick and easy!  Let's look at a record:</p>

<blockquote><div>
  <p>dbadmin=&gt; select gid,ZCTA5CE10,AFFGEOID10,GEOID10,ALAND10,AWATER10,ST_AsText(geom) from cb_2018_us_zcta510_500k where zcta5ce10 = '11554' limit 5;<br />
   gid  | ZCTA5CE10 |   AFFGEOID10   | GEOID10 | ALAND10  | AWATER10 | ST_AsText (* geom field, truncated for publication)                                                                                                                                                                                                                                                                                                                                                                                                                   ST_AsText<br />
  ------+-----------+----------------+---------+----------+----------+-----------------------------------------------------------------------------<br />
   1712 | 11554     | 8600000US11554 | 11554   | 16186098 |    61309 | POLYGON ((-73.587642 40.747566, -73.579641 40.749524, -73.578799 40.746505, <br />
  (1 row)</p>
</div></blockquote>

<p>The key fields we'll look at are the ZIP code, "ZCTA5CE10", and the geometry of the ZIP code tract, "geom".</p>

<p>Now let's test the data by verifying the ZIP code of my ADS-B receiver, which is at longitude (X) -73.54, latitude (Y) 40.71:</p>

<blockquote><div>
  <p>dbadmin=&gt; select gid,ZCTA5CE10,AFFGEOID10,GEOID10,ALAND10,AWATER10 from cb_2018_us_zcta510_500k where ST_Within(STV_GeometryPoint(-73.54,40.71),geom) = 1 limit 5;<br />
   gid  | ZCTA5CE10 |   AFFGEOID10   | GEOID10 | ALAND10  | AWATER10<br />
  ------+-----------+----------------+---------+----------+----------<br />
   1712 | 11554     | 8600000US11554 | 11554   | 16186098 |    61309<br />
  (1 row)</p>
</div></blockquote>

<p>ZIP 11554 is East Meadow, NY, which is correct!  You could also JOIN a table mapping ZIP codes to place names such as this one: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fsimplemaps.com%2Fdata%2Fus-zips">https://simplemaps.com/data/us-zips</a></p>

<p>Vertica offers full support for standard WGS84 geometry and geography types, geospatial functions, and import and export to WKB, WKT, and shapefiles as shown here.</p>

<p>All of these features are included in the free Vertica Community Edition.  Try it out on your data!</p>

<p>References:<br />
Data load: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FAnalyzingData%2FGeospatial%2FGeospatialAnalytics%2FLoadingSpatialDataFromShapefiles.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AnalyzingData/Geospatial/GeospatialAnalytics/LoadingSpatialDataFromShapefiles.htm</a><br />
ST_Within: <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FFunctions%2FGeospatial%2FST_Within.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/Functions/Geospatial/ST_Within.htm</a><br />
Defining a point to use in ST_Within:<br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FFunctions%2FGeospatial%2FSTV_GeometryPoint.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/Functions/Geospatial/STV_GeometryPoint.htm</a></p>
]]>
        </description>
    </item>
    <item>
        <title>Base64 decode/encode functions in Vertica (via Python UDX-SDK)</title>
        <link>https://forum.vertica.com/discussion/241198/base64-decode-encode-functions-in-vertica-via-python-udx-sdk</link>
        <pubDate>Mon, 27 Jan 2020 21:16:49 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>SergeB</dc:creator>
        <guid isPermaLink="false">241198@/discussions</guid>
        <description><![CDATA[<p>A customer recently asked us how to perform base 64 encoding/decoding in a Vertica SQL statement.<br />
While Vertica provides an impressive array of <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FFunctions%2FString%2FStringFunctions.htm">string functions</a>, it doesn't provide Base64 string decode/encode functions.<br />
A quick way to implement those functions is by using <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FPythonSDK%2Findex.html">Vertica's Python UDx SDK</a>.  Base64 is a basic Python module that ships with Vertica and it's very simple to adapt one of the <a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FPythonSDK%2Findex.html">Python UDx SDK</a> examples shipping with Vertica (/opt/vertica/sdk/examples/python ).<br />
Attached is a Python script that implements base64 decode/encode functions.<br />
To load the library:</p>

<blockquote><div>
  <p>CREATE LIBRARY pylib as '/path_to/vb64.py' LANGUAGE 'Python';</p>
</div></blockquote>

<p>To register the base64 decode and encode USER functions:</p>

<blockquote><div>
  <p>CREATE FUNCTION vb64encode AS LANGUAGE 'Python' NAME 'vb64encode_factory' LIBRARY pylib fenced;<br />
   CREATE FUNCTION vb64decode AS LANGUAGE 'Python' NAME 'vb64decode_factory' LIBRARY pylib fenced;</p>
</div></blockquote>

<p>To use these two functions:</p>

<blockquote><div>
  <p>dbuser=&gt; select vb64encode('Vertica');<br />
            vb64encode<br />
          --------------<br />
           VmVydGljYQ==<br />
          (1 row)<br />
   dbuser=&gt; select vb64decode('VmVydGljYQ==');</p>
  
  <h2 data-id="vb64decode"> vb64decode</h2>
  
  <p>Vertica<br />
  (1 row)</p>
</div></blockquote>
]]>
        </description>
    </item>
    <item>
        <title>Viewing Parquet Export Events More Easily</title>
        <link>https://forum.vertica.com/discussion/241196/viewing-parquet-export-events-more-easily</link>
        <pubDate>Mon, 27 Jan 2020 15:23:51 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">241196@/discussions</guid>
        <description><![CDATA[<p>The EXPORT TO PARQUET command exports a table, columns from a table, or query results to files in the Parquet format. When you run EXPORT TO PARQUET information about the files created during the export is stored in the Vertica log. It's no fun combing through a Vertica log looking for those particular records.</p>

<p>Good news! As of Vertica 9.3.1, the V_MONITOR.UDX_EVENTS system table now also records the events logged during the export!</p>

<p><strong>Example:</strong></p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT * FROM test;
 c1
----
  1
  2
  3
(3 rows)

dbadmin=&gt; EXPORT TO PARQUET(DIRECTORY='/home/dbadmin/parq/') AS SELECT * FROM test;
 Rows Exported
---------------
             3
(1 row)

dbadmin=&gt; SELECT created, file, rows FROM v_monitor.udx_events WHERE udx_name = 'ParquetExport';
            created            |                                       file                                       | rows
-------------------------------+----------------------------------------------------------------------------------+------
 2020-01-27 10:05:30.166202-05 | /home/dbadmin/parqhUGvipCI/ad3a94ae-v_test_db_node0002-139833020229376-0.parquet | 3
(1 row)
</pre>

<p><strong>Helpful Links:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FStatements%2FEXPORTTOPARQUET.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/Statements/EXPORTTOPARQUET.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FHadoopIntegrationGuide%2FNativeFormats%2FExportMonitor.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/HadoopIntegrationGuide/NativeFormats/ExportMonitor.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FSystemTables%2FMONITOR%2FUDX_EVENTS.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/MONITOR/UDX_EVENTS.htm</a></p>

<p>Have Fun!</p>
]]>
        </description>
    </item>
    <item>
        <title>Which Database Mode is My Database Using?</title>
        <link>https://forum.vertica.com/discussion/241182/which-database-mode-is-my-database-using</link>
        <pubDate>Tue, 14 Jan 2020 21:24:09 +0000</pubDate>
        <category>Tips from the Team</category>
        <dc:creator>Jim_Knicely</dc:creator>
        <guid isPermaLink="false">241182@/discussions</guid>
        <description><![CDATA[<p>You can run Vertica in either Eon Mode or Enterprise Mode. The primary difference between Eon and Enterprise Modes is where they store data. Eon Mode stores data in a shared object store called communal storage, while Enterprise Mode stores data across the filesystems of the database nodes.</p>

<p>If you are working with a new database that you didn’t create, you can can determine which Mode it is using by querying the V_CATALOG.STORAGE_LOCATIONS or the V_CATALOG.SHARDS system table.</p>

<p><strong>Examples:</strong></p>

<pre spellcheck="false" tabindex="0">dbadmin=&gt; SELECT CASE COUNT(*)
dbadmin-&gt;          WHEN 0 THEN 'Enterprise'
dbadmin-&gt;          ELSE 'Eon'
dbadmin-&gt;        END AS database_mode
dbadmin-&gt;   FROM v_catalog.storage_locations
dbadmin-&gt;  WHERE sharing_type = 'COMMUNAL';
 database_mode
---------------
 Eon
(1 row)

SELECT CASE COUNT(*)
         WHEN 0 THEN 'Enterprise'
         ELSE 'Eon'
       END AS database_mode
  FROM v_catalog.shards;
 database_mode
---------------
 Eon
(1 row)
</pre>

<p><strong>Helpful Links:</strong><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FEon%2FVerticaArchitectureEonVsEnterpriseMode.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/Eon/VerticaArchitectureEonVsEnterpriseMode.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FEon%2FComparingEonandEnterpriseModes.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/Eon/ComparingEonandEnterpriseModes.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FSystemTables%2FCATALOG%2FSTORAGE_LOCATIONS.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/CATALOG/STORAGE_LOCATIONS.htm</a><br /><a rel="nofollow" href="https://forum.vertica.com/home/leaving?allowTrusted=1&amp;target=https%3A%2F%2Fwww.vertica.com%2Fdocs%2F9.3.x%2FHTML%2FContent%2FAuthoring%2FSQLReferenceManual%2FSystemTables%2FCATALOG%2FSHARDS.htm">https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/SystemTables/CATALOG/SHARDS.htm</a></p>

<p>Have Fun!</p>
]]>
        </description>
    </item>
   </channel>
</rss>
