Vertica Blog

Vertica Blog

SQL

UNNEST vs EXPLODE Functions

Vertica provides two functions, UNNEST and EXPLODE to expand arrays into one or more rows. These functions offer the same functionality with subtle differences in syntax and output. Let's understand with a simple example. We have 3 array columns in the table. Let us expand 1 array column for a particular order key. Explode provides...

How to Group Timeseries Data at Any Granularity

You might have come across this. You would have obtained a huge set of time stamped log data or sensor data that you would like to understand. Millions of rows are nothing for human consumption - and far too much for plotting on a monitor that just has a few thousand pixels across - why...
A key with a key hole and Unlock Vertica Potential in text at the bottom

How to Use Database Designer to Optimize Vertica Physical Data Model in Six Steps

Vertica provides out-of-the-box a powerful tool to tune its Physical Data Model: Database Designer (DBD from now on). You can run DBD using the Management Console GUI but in this article we will focus on what they call “programmatic interface” (read... plain SQL) and – as practical examples are often more enlightening than “theoretical” documentation...
Helpful Tips in blue text with magnifying glass

Restrict Modifying Table Rows (UPDATE/DELETE) Irrespective of User Privileges

Do you have a table with critical information such as SIEM events or credit card transactions? Do you want to be able to block user access to UPDATE/DELETE rows in those tables? From version 12.0.0, you can do this by setting the tables as IMMUTABLE. This means you can only insert data and not modify...
Tips in bright neon red letters on a dark background with touchscreens.

High Availability for a Vertica in Eon Mode Database with Read-Only Mode

When Vertica is deployed in Eon Mode, there are two major requirements for high availability: maintaining quorum and shard coverage. If either of them is lost, the whole cluster goes down. Before going into details, let us understand what quorum and shard coverage mean. Quorum: In Eon Mode, more than half of the primary nodes...
SQL Query Optimization

Improving COUNT DISTINCT Performance with Approximate Functions

A common analytic use case is to find the number of distinct items in a data set. Vertica performs well at solving COUNT DISTINCT in a few ways. Since Vertica stores all data in columns, it is possible to optimize for COUNT DISTINCT by building a projection that is tuned for this use case. Vertica...
spark plus vertica hands touching

Unleash the Power of Vertica and Apache Spark Using the Upgraded Spark Connector

This post is authored by Alex Le What is Apache Spark? Apache Spark is a distributed compute engine that provides a robust API for data science, machine learning, or to work with big data. It is fast, scalable, simple, and supports multiple languages, including Python, SQL, Scala, Java, and R. Backed by the Apache 2.0...
data lakehouse example

Going Beyond a Data Lakehouse

The way things get named in this industry can be pretty odd.  A lot of people have been hearing noise about how cool a “Data Lakehouse” is since it combines the power of a data lake with the power of a data warehouse. When I think of a lakehouse, I think of a great place...

Quick Tip: Replacing non-UTF-8 Characters

Vertica database servers expect to receive all data in UTF-8 and Vertica outputs all data in UTF-8. However, you can load or insert data into Vertica that is non UTF-8, but you'll want to clean it up. I used to recommend the REGEXP_REPLACE function for that task, but now there is a better way! Vertica...
Helpful Tips in blue text with magnifying glass

Quick Tip: Determining Database “Cell” Count

The Vertica system tables LICENSE_AUDITS and USER_AUDITS include a mysterious column called CELL_COUNT. What exactly is the Cell Count? It's simply a calculation that looks like this: DATABASE CELL_COUNT = (Table_1 Column Count * Table_1 Row Count) + (Table_2 Column Count * Table_2 Row Count) + … + (Table_n Column Count * Table_n Row Count)...
SQL

Quick Tip: WITH Clause Recursion

Starting with version 10.1.x, Vertica supports recursive queries. These are incredibly useful in modeling and working with self-referential hierarchical data. Let's take a look at a natural instance of this form of data: the manager-subordinate relationship. The following table contains employees (EMP_NAME), their IDs (EMP_ID), and the IDs of their managers (EMP_MGR_ID). For example, the...
Tips and Tricks Orange Button

Quick Tip: Create “Super Wide” Tables

Starting in Vertica 10.1.0, you can go super wide with up to 9,800 column definitions in a table! Prior to Vertica 10.1.x, tables were limited to 1,600 columns. Example Creating a table with 9,800 columns: Hint: Try to avoid running a SELECT * FROM … a table with 9,800 columns and a trillion+ rows 😊...