Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Sunday, March 30, 2014

Redshift sample schema from AWS web site

Below are the sample schemas that can be used when getting started with AWS Redshift. More information can be found here: http://docs.aws.amazon.com/redshift/latest/gsg/getting-started.html

create table users(
     userid integer not null distkey sortkey,
     username char(8),
     firstname varchar(30),
     lastname varchar(30),
     city varchar(30),
     state char(2),
     email varchar(100),
     phone char(14),
     likesports boolean,
     liketheatre boolean,
     likeconcerts boolean,
     likejazz boolean,
     likeclassical boolean,
     likeopera boolean,
     likerock boolean,
     likevegas boolean,
     likebroadway boolean,
     likemusicals boolean);

create table venue(
     venueid smallint not null distkey sortkey,
     venuename varchar(100),
     venuecity varchar(30),
     venuestate char(2),
     venueseats integer);

create table category(
     catid smallint not null distkey sortkey,
     catgroup varchar(10),
     catname varchar(10),
     catdesc varchar(50));

create table date(
     dateid smallint not null distkey sortkey,
     caldate date not null,
     day character(3) not null,
     week smallint not null,
     month character(5) not null,
     qtr character(5) not null,
     year smallint not null,
     holiday boolean default('N'));

create table event(
     eventid integer not null distkey,
     venueid smallint not null,
     catid smallint not null,
     dateid smallint not null sortkey,
     eventname varchar(200),
     starttime timestamp);

create table listing(
     listid integer not null distkey,
     sellerid integer not null,
     eventid integer not null,
     dateid smallint not null  sortkey,
     numtickets smallint not null,
     priceperticket decimal(8,2),
     totalprice decimal(8,2),
     listtime timestamp);

create table sales(
     salesid integer not null,
     listid integer not null distkey,
     sellerid integer not null,
     buyerid integer not null,
     eventid integer not null,
     dateid smallint not null sortkey,
     qtysold smallint not null,
     pricepaid decimal(8,2),
     commission decimal(8,2),

     saletime timestamp);

Saturday, August 10, 2013

VPC and AZs when using ELB and Auto Scaling


Here are a couple of things to be aware of when using Auto Scaling, VPC, and ELB with Auto Scaling:

1. There is a limitation on ELB in regards to AZs and subnets.   You can only have one subnet per AZ.  You will most likely be creating an ELB (and using VPC) when using Auto Scaling so it is important to understand this.
2. When creating an autoscaling group (as-create-auto-scaling-group), make sure to specific the VPC subnets and AZs if you are using .  The VPC subnets need to be in the AZs specified in the AZ parameter for the as-create-auto-scaling-group command. No checking is done to make sure this is true so it is up to you to make sure these AZs actually exist in the subnets you specify.