Vertica Blog

Vertica Blog


Hand writing the text: Helpful Tips

Analyzing JSON Already Loaded into Vertica Regular Tables

Vertica flex tables allow you to query data in JSON format. But what if you've imported JSON objects into VARCHAR already? Here's how you can extract the JSON into flex tables without exporting and importing. Let's create a sample table with a JSON column to convert: Now let's create a flex table: Flex tables use...
Data Definition Language in red 3D text in a field of white 3D ones and zeros

Export CREATE OR REPLACE DDL for Database Views

The EXPORT_OBJECTS Catalog Management Function generates a SQL script you can use to recreate non-virtual catalog objects on another cluster. When you export a database view, Vertica includes the CREATE VIEW DDL in the output. But what if you want the DDL to be CREATE OR REPLACE VIEW? You can make that change with the...
Vintage businessman concept pointing on the wall wearing futuristic helmet at office

Hash Function Result Depends on Data Type and Sometimes Size

The Vertica HASH function calculates a hash value over the function arguments, producing a value in the range 0
Helpful Tips in blue text with magnifying glass

Loading Data Stored in Scientific Notation to an Integer Column

Scientific notation is a way of expressing numbers that are too big or too small to be conveniently written in decimal form. Vertica can display numbers in scientific notation in decimal form with ease. That is, unless the value is a string! You first have to convert the VARCHAR to a NUMERIC and then to...
Construction site crane building a blue SQL 3D text.

Creating Vertica Functions in Third Party Tools

Third party SQL client tools that connect to Vertica often provide a SQL command window where you can type SQL commands and view the results. Most of these tools’ SQL command windows support issuing multiple commands in a single SQL block, using the semicolon as the command delimiter. Here is an example in DbVisualizer: The...
Red and blue square dots fly from scattered into two neat rows arranged by color.

Auto-Projection Column Sort Order

Auto-projections are superprojections that Vertica automatically generates for tables, both temporary and persistent. Vertica uses the current value of the MaxAutoSortColumns configuration parameter to determine which table columns are included in the auto-projection sort order. Helpful Links: Have fun!
Hand with suit cuff flips shiny gold coin

Coin Flip User Defined SQL Function

In the past when my wife and I couldn’t decide which of two restaurants to go to grab dinner, we opened the Coin Flip app on one of our phones to let it decide. Now I let Vertica choose for us via a simple User Defined SQL Function! dbadmin=> SELECT coin_flip, COUNT(*) FROM (SELECT coin_flip()...
Quick Tip - blue button

Non-DBADMIN Access to System Tables (Table by Table)

The DBADMIN can assign a delegate the SYSMONITOR role to grant full access to system tables without granting full DBADMIN access. The SYSMONITOR role applies to all tables that have the flag IS_MONITORABLE set to true in the SYSTEM_TABLES system table. What if I want a non-DBADMIN user to have full access to only a...
Compass rose with true north pointing to "Helpful Tips" text

Tracking VBR Invocations

The Vertica Backup and Recovery tool (vbr) allows you to back up and restore either the full database, or one or more schema and table objects of interest. You can also copy a cluster and list backups you created previously. You can view vbr invocations by querying the DC_VBR_INVOCATIONS data collector table! Helpful Links:
Vintage businessman concept wearing futuristic helmet at office

Track License Usage Over Time

The LICENSE_AUDITS system table lists the results of Vertica's license automatic compliance audits. You can query it to track your Vertica license usage over time! Looks like I’m going to need add some new Vertica license soon! Helpful Links: Have fun!
Tips and Tricks Orange Button

A Quick Way to View the Current and Ancient History Mark Epochs

The MANAGE_EPOCH function can be called to quickly display the Current Epoch (CE) and Ancient History Mark (AHM) Epochs! Helpful Links: Have fun!
Helpful Tips message on post-it note

Enable All Granted Roles on Login

You can automatically enable roles for users in two ways: Enable roles for individual users on login (either with the SET ROLE command or default roles). Enable all roles for all users on login (at the database level via the EnableAllRolesOnLogin parameter). The second option is great (and easy) if you want all users to...