range-segmentation-clause
Range segmentation allows you to segment a projection based on a known range of values stored in a specific column chosen to provide even distribution of data across a set of nodes, resulting in optimal query execution.
Vertica Systems, Inc. recommends that you use
Hash Segmentation instead of range segmentation.
Hash segmentation allows you to segment a projection based on a built-in hash function that provides even distribution of data across some or all of the nodes in a cluster, resulting in optimal query execution.
Syntax
SEGMENTED BY expression
NODE node VALUES LESS THAN value

NODE node VALUES LESS THAN MAXVALUE
Semantics (Range Segmentation)
SEGMENTED BY expression
|
is a single column reference to a column in the SELECT list of the CREATE PROJECTION command. Choose a column that has:
Syntax
[ tablename. ] columnname
Semantics
tablename
|
is one of:
- the name of a table
- an alias for a table defined by means of a FROM clause in a query
|
columnname
|
is the name of a column that must be unique across all the tables being used in a query
|
Notes
- There are no space characters in a column reference.
|
NODE node
|
a symbolic name for a node. You can use a specific node only once in any projection. For a list of the nodes in a database, use the View Database command in the Administration Tools.
The tools needed for administering a Vertica database are provided in the form of a graphical user interface that allows you to perform various tasks quickly and easily. The tools also provide a convenient way to connect to a database using vsql. Always run the Administration Tools on the Administration Host if possible.
vsql is the Vertica implementation of psql, a character-based, interactive, front-end that is part of PostgreSQL and used by other database management systems. It allows you to type in SQL statements and see the results. It also provides a number of meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks.
$ /opt/vertica/bin/adminTools
See the Administration Tools Reference for a complete description.
|
VALUES LESS THAN value
|
specifies that this segment can contain a range of data values less than the specified value, except that segments cannot overlap. In other words, the minimum value of the range is determined by the value of the previous segment (if any).
|
MAXVALUE
|
specifies a sub-range with no upper limit. In other words, it represents a value greater than the maximum value that can exist in the data. The maximum value depends on the data type of the segmentation column.
|
Notes
- The
SEGMENTED BY
expression syntax allows a general SQL expression but there is no reason to use anything other than a single
column reference for range segmentation. If you wish to use a different expression, the following restrictions apply:Syntax
[ tablename. ] columnname
Semantics
tablename
|
is one of:
- the name of a table
- an alias for a table defined by means of a FROM clause in a query
|
columnname
|
is the name of a column that must be unique across all the tables being used in a query
|
Notes
- There are no space characters in a column reference.
- All leaf expressions must be either
constants or
column-references toa column in the SELECT list of the CREATE PROJECTION commandSyntax
[ tablename. ] columnname
Semantics
tablename
|
is one of:
- the name of a table
- an alias for a table defined by means of a FROM clause in a query
|
columnname
|
is the name of a column that must be unique across all the tables being used in a query
|
Notes
- There are no space characters in a column reference.
- Aggregate functions are not allowed
- The expression must return the same value over the life of the database.
- During INSERT or COPY to a segmented projection, if expression produces a value outside the expected range (a negative value for example), no error occurs, and the row is added to a segment of the projection.
- CREATE PROJECTION with range segmentation accepts the deprecated syntax
SITE
node for compatibility with previous releases. - CREATE PROJECTION with range segmentation allows the
SEGMENTED BY
expression to be a single column-reference to a column in the projection-column list for compatibility with previous releases. This syntax is considered to be a deprecated feature and causes a warning message. See DEPRECATED syntax in the Troubleshooting Guide.