This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
admin:features:grids:creation:sql [2011/01/11 02:29] els created |
admin:features:grids:creation:sql [2012/10/26 15:00] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOTOC~~ | ||
{{page>:top_add&nofooter&noeditbtn}} | {{page>:top_add&nofooter&noeditbtn}} | ||
Line 5: | Line 6: | ||
===== Omnidex Grids ===== | ===== Omnidex Grids ===== | ||
- | **[[admin:features:grid:creation|Back to Grid Creation]]** | + | **[[admin:features:grids:creation|Back to Grid Creation]]** |
---- | ---- | ||
Line 17: | Line 18: | ||
These instructions describe how to create an Omnidex Grid using SQL Statements. It is also possible to create an Omnidex Grid using the [[admin:features:grids:creation:odxadmin| Omnidex Administrator]]. | These instructions describe how to create an Omnidex Grid using SQL Statements. It is also possible to create an Omnidex Grid using the [[admin:features:grids:creation:odxadmin| Omnidex Administrator]]. | ||
- | ===== Steps to create an Omnidex Grid using SQL Statements ===== | + | ==== Steps to create an Omnidex Grid using SQL Statements ==== |
- | ==== 1. Create an environment pointing to the original database ==== | + | === 1. Create an environment pointing to the original database === |
Omnidex Grids needs an environment that points to the original database so that the data can be partitioned. This environment is a standard environment that accesses the underlying database. | Omnidex Grids needs an environment that points to the original database so that the data can be partitioned. This environment is a standard environment that accesses the underlying database. | ||
- | ==== 2. Partition the database ==== | + | === 2. Partition the database === |
- | If the database will be logically partitioned, then create the relational views that correlate with the partitioning strategy. If the database will be physically partitioned using an Omnidex Snapshot, then partition the database using the PARTITION command. | + | If the database will be logically partitioned, then create the relational views that correlate with the partitioning strategy. If the database will be physically partitioned using an Omnidex Snapshot, then partition the database using the PARTITION statement. |
- | The PARTITION command is available in the Omnidex SQL language, and is callable from the OdxSQL application. Since the command is in the Omnidex SQL language, it may also be called directly from ODBC and JDBC. | + | The PARTITION statement is available in the Omnidex SQL language, and is callable from the OdxSQL application. Since the statement is part of the Omnidex SQL language, it may also be called directly from ODBC and JDBC. |
- | The PARTITION command allows the table to be partitioned one of three ways, 1) into a specific number of equally sized partitions, 2) into separate partitions based on a partition qualifier consisting of a column or a SQL expression, or 3) a combination of these two steps. In the third case, Omnidex will evaluate the cardinality of the partition qualifier and group values together to comprise the specific number of partitions in as equal size as possible. The syntax of the PARTITION command is: | + | The PARTITION statement allows the table to be partitioned one of three ways, 1) into a specific number of equally sized partitions, 2) into separate partitions based on a partition qualifier consisting of a column or a SQL expression, or 3) a combination of these two steps. In the third case, Omnidex will evaluate the cardinality of the partition qualifier and group values together to comprise the specific number of partitions in as equal size as possible. The syntax of the PARTITION statement is: |
PARTITION table [INTO n [PARTITIONS]] [BY column] | PARTITION table [INTO n [PARTITIONS]] [BY column] | ||
Line 35: | Line 36: | ||
[WITH options] | [WITH options] | ||
- | An example of a command to partition a table is: | + | An example of a statement to partition a table is: |
PARTITION LIST BY “STATE || SUBSTRING(ZIP from 1 for 2)” | PARTITION LIST BY “STATE || SUBSTRING(ZIP from 1 for 2)” | ||
IN D:\grid\data | IN D:\grid\data | ||
- | ==== 3. Distribute both the partitioned and partitioned data across the grid. ==== | + | === 3. Distribute the partitioned data across the grid. === |
If the database will be logically partitioned, then make sure each grid server has access to the database. If the database will be physically partitioned, then distribute both the partitioned and unpartitioned data to the grid nodes. If each node will be in its own directory, then the data files can be copied or symbolically linked to the correct locations. It is also possible for multiple nodes to share the same physical directories as long as the partitioned data can be differentiated. | If the database will be logically partitioned, then make sure each grid server has access to the database. If the database will be physically partitioned, then distribute both the partitioned and unpartitioned data to the grid nodes. If each node will be in its own directory, then the data files can be copied or symbolically linked to the correct locations. It is also possible for multiple nodes to share the same physical directories as long as the partitioned data can be differentiated. | ||
- | ==== 4. Create the environment file for the Omnidex Grid. ==== | + | === 4. Create the environment file for the Omnidex Grid. === |
The environment file for the Omnidex Grid is a normal environment file; however, it has additional information that describes the locations of the nodes and the partitioning scheme. There are changes that need to be made for the ENVIRONMENT statement, the DATABASE statement and the TABLE statements. Note that older versions of Omnidex Grids had a RULE statement at the bottom, and that is no longer necessary. | The environment file for the Omnidex Grid is a normal environment file; however, it has additional information that describes the locations of the nodes and the partitioning scheme. There are changes that need to be made for the ENVIRONMENT statement, the DATABASE statement and the TABLE statements. Note that older versions of Omnidex Grids had a RULE statement at the bottom, and that is no longer necessary. | ||
- | === The CREATE ENVIRONMENT statement === | + | == The CREATE ENVIRONMENT statement == |
- | The CREATE ENVIRONMENT statement is used to declare the grid nodes and their connection information. The NODE declarations in the CREATE ENVIRONMENT statement are show below. Consult the documentation on the [[admin:environments:create:sql:syntax#creat_environment | CREATE ENVIRONMENT]] statement for the complete syntax. | + | The CREATE ENVIRONMENT statement is used to declare the grid nodes and their connection information. The NODE declarations in the CREATE ENVIRONMENT statement are show below. Consult the documentation on the [[dev:sql:statements:create_environment:home | CREATE ENVIRONMENT]] statement for the complete syntax. |
<code> | <code> | ||
Line 64: | Line 65: | ||
Here is an example of a CREATE ENVIRONMENT statement for an Omnidex Grid. | Here is an example of a CREATE ENVIRONMENT statement for an Omnidex Grid. | ||
- | <code> | + | <code sql> |
create environment "list_env" | create environment "list_env" | ||
maxthreads 4 | maxthreads 4 | ||
Line 74: | Line 75: | ||
</code> | </code> | ||
- | === The CREATE DATABASE statement === | + | == The CREATE DATABASE statement == |
- | The CREATE DATABASE statement is used to declare the database characteristics for each node. The NODE declarations in the CREATE DATABASE statement are show below. Consult the documentation on the [[admin:environments:create:sql:syntax#create_database | CREATE DATABASE]] statement for the complete syntax. | + | The CREATE DATABASE statement is used to declare the database characteristics for each node. The NODE declarations in the CREATE DATABASE statement are show below. Consult the documentation on the [[dev:sql:statements:create_database:home | CREATE DATABASE]] statement for the complete syntax. |
<code> | <code> | ||
Line 93: | Line 94: | ||
Here is an example of a CREATE DATABASE statement for an Omnidex Grid. | Here is an example of a CREATE DATABASE statement for an Omnidex Grid. | ||
- | <code> | + | <code sql> |
create database "list" | create database "list" | ||
node NODE01 | node NODE01 | ||
Line 109: | Line 110: | ||
</code> | </code> | ||
- | === The CREATE TABLE statement === | + | == The CREATE TABLE statement == |
- | The CREATE TABLE statement is used to declare the table characteristics for each node for each partitioned table in the grid. The NODE declarations in the CREATE TABLE statement are show below. Consult the documentation on the [[admin:environments:create:sql:syntax#create_table | CREATE TABLE]] statement for the complete syntax. | + | The CREATE TABLE statement is used to declare the table characteristics for each node for each partitioned table in the grid. The NODE declarations in the CREATE TABLE statement are show below. Consult the documentation on the [[dev:sql:statements:create_table:home | CREATE TABLE]] statement for the complete syntax. |
<code> | <code> | ||
Line 127: | Line 128: | ||
Here is an example of a CREATE TABLE statements for an Omnidex Grid. | Here is an example of a CREATE TABLE statements for an Omnidex Grid. | ||
- | <code> | + | <code sql> |
create table "HOUSEHOLDS" | create table "HOUSEHOLDS" | ||
node NODE01 | node NODE01 | ||
Line 155: | Line 156: | ||
</code> | </code> | ||
- | As discussed in the [[admin:grid:partitions#how_are_referential_constraints_handled_such_as_primary_and_foreign_keys| partition scheme]], it is necessary to partition tables so that referential integrity is maintained. Typically, the parent is partitioned using criteria, as shown for HOUSEHOLDS above, and the child is partitioned along the foreign key. The PARTITION BY clause for a child shows the join criteria, as shown below: | + | As discussed in the [[admin:features:grids:partitions#how_are_referential_constraints_handled_such_as_primary_and_foreign_keys| partition scheme]], it is necessary to partition tables so that referential integrity is maintained. Typically, the parent is partitioned using criteria, as shown for HOUSEHOLDS above, and the child is partitioned along the foreign key. The PARTITION BY clause for a child shows the join criteria, as shown below: |
- | <code> | + | <code sql> |
create table "INDIVIDUALS" | create table "INDIVIDUALS" | ||
node NODE01 | node NODE01 | ||
Line 177: | Line 178: | ||
- | ==== 5. Install and build Omnidex indexes on each node. ==== | + | === 5. Install and build Omnidex indexes on each node. === |
It is recommended, though not required, that each node be indexed the same. This reduces the likelihood of queries taking too long because of a lack of indexing on one node. | It is recommended, though not required, that each node be indexed the same. This reduces the likelihood of queries taking too long because of a lack of indexing on one node. | ||
Line 184: | Line 185: | ||
- | ==== 6. Start Omnidex Network Services on each server. ==== | + | === 6. Start Omnidex Network Services on each server. === |
Omnidex network services must be started on every machine that contains grid nodes. No special options are required. | Omnidex network services must be started on every machine that contains grid nodes. No special options are required. | ||
Line 191: | Line 192: | ||
- | ==== 7. Perform queries against the controller. ==== | + | === 7. Perform queries against the controller. === |
Applications should connect to the grid controller as though it was a standard Omnidex environment. | Applications should connect to the grid controller as though it was a standard Omnidex environment. | ||
+ | ==== ==== | ||
+ | **[[admin:features:grids:creation|Prev]]** | ||
- | ### | + | ====== Additional Resources ====== |
- | + | See also: | |
- | ===== ===== | + | |
- | + | ||
- | **[[prev|Prev]]** | **[[next|Next]]** | + | |
- | + | ||
- | ====== Additional Resources ====== | + | |
{{page>:admin:features:see_also&nofooter&noeditbtn}} | {{page>:admin:features:see_also&nofooter&noeditbtn}} | ||
{{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} |