Book Contents

Book Index

Next Topic

Home

Tutorial Procedure

This tutorial procedure assumes that you have already installed Vertica on a cluster of hosts as described in the Installation Guide.

This procedure omits screen captures of Administration Tools dialogs that are self-explanatory. For complete descriptions of each dialog, refer to the Administration Tools Reference in the Database Administrator's Guide.

  1. Choose an example database. The tutorial procedure is the same for all of the example databases. The examples in this section use use the Stock Exchange Example Database. If you are using a different database, replace stock with clickstream, credithistory, retail, or telecom in each example.
  2. Log in to the database administrator account that was created by the installation script. The default account name is dbadmin.
  3. Copy your chosen example database directory to a directory on the Administration Host. Do not use the default data directory (home/dbadmin). For example:

    $ mkdir /scratch/examples

    $ cp -r /opt/vertica/doc/Stock_Schema /scratch/examples

  4. Set your current directory to the example database directory:

    $ cd /scratch/examples/Stock_Schema

    Do not change directory while following this tutorial. Some of the steps depend on it being set to the example database directory.

  5. Run the sample data generator program using the default parameters. The parameter names are listed in the README file.

    $ ./stock_gen

    Using default parameters

    numfiles = 1

    numfactrows = 5000000

    numstockkeys = 273

    numsplitkeys = 500

    numtraderkeys = 200

    random# = 20177

    timefile = Time.txt

    If the stock_gen executable file is not present or does not work correctly, recompile it. This example uses the GNU C++ compiler, which is a free download. You can use any other C++ compiler.

    $ g++ stock_gen.cpp -o stock_gen

    $ chmod +x stock_gen

     

    If you are using VMware, the default 5M row fact table load will probably fail. Specify a smaller fact table size such as 1000000 (1M) rows as described in Generating Custom Data Files. The maximum size of a bulk load depends on the system resources and cannot be determined accurately.

  6. Run the Administration Tools.

    $ /opt/vertica/bin/adminTools

    A quick reference to the Administration Tools Keystrokes is available at the end of this document.

    If you are using a remote terminal application such as PuTTY or a Cygwin bash shell, see Notes for Remote Terminal Users.

  7. Accept the license agreement (once only).
  8. Specify the location of your license key file (once only).
  9. Go to the Configuration menu and select Create Database.

    Linked PNG File Template

  10. Create a database named Stock_Schema.

    Create a database Stock_Schema

  11. Do not specify a password.

  12. Confirm that you do not want a password.

    There is no need for a database superuser password in this tutorial. However, when you create a production database, always specify a superuser password. Otherwise, the database is permanently set to trust authentication (no passwords).

  13. Select the hosts that you want to include in the database cluster.

  14. Use the default pathnames for the data and catalog directories. Catalog and data pathnames must contain only alphanumeric characters and cannot have leading space characters. Failure to comply with these restrictions may result in database creation failure.

    Database data directories

    When you create a production database, you will probably specify other locations. See Prepare Disk Storage Locations in the Database Administrator's Guide for more information.

  15. Create the database.

     Vertica automatically creates a set of node definitions based on the database name and the names of the hosts you selected.

  16. Go back to the Main Menu and select Connect to Database.

    Welcome to the vsql, Vertica_Database v2.1.GA interactive terminal.

    Type: \h for help with SQL commands

    \? for help with vsql commands

    \g or terminate with semicolon to execute query

    \q to quit

    Stock_Schema=>

  17. Execute the SQL script stock_define_schema.sql using the \i meta-command in vsql. This creates the tables and referential integrity constraints that make up the logical schema.

    Stock_Schema=> \i stock_define_schema.sql

    CREATE TABLE

    ALTER TABLE

  18. Return to the Administration Tools (quit vsql).

    Stock_Schema=> \q

  19. In the Configuration menu, select Create New Database Design.
  20. In the Select a database form, select Stock_Schema.
  21. In the Enter directory form, use the default pathname for output and log files.

    DB Designer Stock_Schema

  22. In the Database Designer form, use the default parameters.

    Database Designer (dialog)

    A complete description of the Database Designer dialog is provided in the Database Administrator's Guide.

  23. In the Design type menu, select Opt - Create a design optimized for queries.

    Design type (Basic)

  24. In the Design Optimizer form, enter the pathname of the sample queries file.

    Design Optimizer

  25. The Database Designer prints status messages to the standard output while it is working. Several minutes may pass before the following success message appears.

    DB Designer successful Stock_Schema.

  26. Go back to the Main Menu and select Connect to Database.

    Welcome to the vsql, Vertica_Database v2.1.GA interactive terminal.

    Type: \h for help with SQL commands

    \? for help with vsql commands

    \g or terminate with semicolon to execute query

    \q to quit

    Stock_Schema=>

  27. Execute the SQL script generated by the Database Designer to create the projections that make up the physical schema.

    Stock_Schema=> \i Stock_Schema_design_opt_1.sql

    CREATE PROJECTION

    CREATE PROJECTION

    mark_design_ksafe

    ----------------------

    Marked design 1-safe

    (1 row)

  28. Execute the SQL script stock_load_data.sql to load the example data.

    Stock_Schema=> \i stock_load_data.sql

    COPY

    COPY

    It may take several minutes to load the default five-million row fact table on a typical hardware cluster. You can watch the load by examining the vertica.log file as described in the Monitoring the Log Files section of the Database Administrator's Guide.

  29. Proceed to Running Simple Queries.