Documentation — User's guide

Manage objects

Two complete examples: a narrow table, then a wide one. Replace DC1 with a datacenter of your cluster (show datacenters;).

A narrow table

create table visitors ( id bigint not null, name varchar(40), country char(2) );
alter table visitors set datacenter 'DC1';
alter table visitors set hash key id;
deploy table visitors on 4 partitions;

The table now exists on the data brokers. Use it:

insert into visitors values ( 1, 'Ada', 'FR' );
select id, name from visitors where id = 1;
delete from visitors where id = 1;
describe visitors;

A wide table

Create the table empty and declare the columns in batches with alter table:

create table cells wide;
alter table cells add id int, add gene_00000 int, add gene_00001 int, add gene_00002 int;
alter table cells set hash key id;
alter table cells set datacenter 'DC1';
deploy table cells on 4 partitions;

All the columns must exist before deploy table: a deployed wide table cannot receive new columns. For hundreds of thousands of columns, send the alter table statements in batches of about 25,000 columns, from a file with source. The test tables of this site were created this way.

A select on a wide table must select every column of the hash key:

select id, gene_00001 from cells where gene_00001 < 100;

Look at what you have

show tables;
describe cells;
describe cells show columns where name like 'gene_0000%' limit 5;

Remove it

drop table cells;

You need the DROP privilege on the table. The owner has it.

← Tools  |  Consistent data →