User guide
FROM pg_table_def
WHERE tablename = 'sales';
-- Find total sales on a given calendar date.
SELECT sum(qtysold)
FROM sales, date
WHERE sales.dateid = date.dateid
AND caldate = '2008-01-05';
-- Find top 10 buyers by quantity.
SELECT firstname, lastname, total_quantity
FROM (SELECT buyerid, sum(qtysold) total_quantity
FROM sales
GROUP BY buyerid
ORDER BY total_quantity desc limit 10) Q, users
WHERE Q.buyerid = userid
ORDER BY Q.total_quantity desc;
-- Find events in the 99.9 percentile in terms of all-time gross sales.
SELECT eventname, total_price
FROM (SELECT eventid, total_price, ntile(1000) over(order by total_price desc)
as percentile
FROM (SELECT eventid, sum(pricepaid) total_price
FROM sales
GROUP BY eventid)) Q, event E
WHERE Q.eventid = E.eventid
AND percentile = 1
ORDER BY total_price desc;
Step 4: Resize the Target Cluster
Once you verify that your target cluster works as expected, you can resize the target cluster.You can
continue to allow write and read-write operations in the source cluster, because later in this tutorial you
will copy any data that was loaded after your snapshot to the target.
1. Open the Amazon Redshift console.
2. In the navigation pane, click Clusters, and then click the cluster to open. If you are using the same
cluster from this tutorial, click examplecluster-target.
3. On the Configuration tab of the Cluster details page, click Resize in the Cluster list.
4. In the Resize Cluster window, select the following values:
• Node Type: dw2.large.
• Cluster Type: Multi Node.
• Number of Nodes: 2.
API Version 2012-12-01
232
Amazon Redshift Management Guide
Step 4: Resize the Target Cluster