36
loading...
This website collects cookies to deliver better user experience
SELECT INTO
to copy result into another tableSELECT factOne, factTwo
INTO OtherServer.newFactTable
FROM table X, Y
WHERE X.id = Y.fid
GROUP BY Y.d
// common prefix example
// this will output a lot of files with */split/part-*
COPY cars FROM 's3://whererver/cars/split/part'
CREDENTIALS 'aws_iam_role=arn:aws:iam:0815:role/redshiftRole'
qzip DELEIMTER ';' REGION 'eu-central-1';
// manifest example
COPY table
FROM 's3://yourbucket/cust.manifest'
IAM_ROLE 'arn:aws:iam:0815:role/redshiftRole'
manifest
ORDER BY
in our queries we should use a sort key in the fact tables.CREATE TABLE order(
o_orderkey integer not null,
o_custkey integer not null,
o_partkey integer not null DISTKEY,
o_date integer not null SORTKEY
)
CREATE TABLE part(
p_partkey integer not null SORTKEY DISTKEY,
p_name varchar(250) not null,
p_color varchar(250) not null
)
UNLOAD ('select * from cars limit 100')
TO 's3://yourbucket/cars_pipe_'
IAM_ROLE 'arn:aws:iam:0815:role/redshiftRole'