Installing the Example Database
Vertica gives you two options to install the example database:
- An advanced-but-simple example database installation using the Administration Tools interface. See Tutorial: Setting up an Example Database in this guide for details.
- A quick installation script that lets you create the example database and start using it immediately, as described in this topic.
Installing the Example Database From a Script
The scripts are located in /opt/vertica/sbin
and are called:
- install_example— Creates a database on the default port (5433), generates data, creates the schema and a default superprojection, and loads the data.
- delete_example— Drops the database
-
In a terminal window, log in as the DBA user:
# su dbadmin
-
Run the install_example script:
$ /opt/vertica/sbin/install_example VMart
-
Connect to the database:
$ /opt/vertica/bin/vsql
Alternatively connect to the database using the Administration Tools and select Connect to Database from the Main Menu:
$ admintools
-
Run a simple query. For example, to count all the records in the
store_sales_fact
table:=> SELECT COUNT(1) FROM store.store_sales_fact;
Note: If you have not already done so, you must accept the EULA (one time only) using the Administration Tools. You'll also do that in Step 2 of the Tutorial.
The example database log files, ExampleDelete.txt and ExampleInstall.txt, are written to /opt/vertica/examples/log
.
Example Database Script
While you can create your own queries, the VMart example directory contains a sample query script file that you can use help to get you started quickly. You can find the sample script at this path: /opt/vertica/examples/VMart_Schema
The following table describes the scripts available, where {identifier} is the name of the example database:
Script Name | Description |
---|---|
{identifier}_count_data.sql |
Counts rows of all example database tables |
{identifier}_define_schema.sql |
Defines the schema for each table |
{identifier}_gen |
Is the sample data generator |
{identifier}_load_data.sql |
Loads data to the corresponding tables using COPY DIRECT |
{identifier}_queries.sql |
Contains all sample queries |
{identifier}_schema_drop.sql |
Drops all example database tables |
{identifier}_query_##.sql |
Are the individual queries; for example query #1 through “n” |
Deleting the Example Database
To remove an example database:
-
Log in as dbadmin; for example:
# su dbadmin
-
Run the
delete_example
script:$ /opt/vertica/sbin/delete_example <example_name>
Where <example_name> is the name of the example database you provided to the install script.