This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* create elb raw logs table with partition */ | |
CREATE EXTERNAL TABLE IF NOT EXISTS elb_logs_raw_partition ( | |
request_timestamp string, | |
elb_name string, | |
request_ip string, | |
request_port int, | |
backend_ip string, | |
backend_port int, | |
request_processing_time double, | |
backend_processing_time double, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTERNAL TABLE IF NOT EXISTS elb_logs_raw ( | |
request_timestamp string, | |
elb_name string, | |
request_ip string, | |
request_port int, | |
backend_ip string, | |
backend_port int, | |
request_processing_time double, | |
backend_processing_time double, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VACUUM FULL schema.table; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM schema.table | |
WHERE ts < (SELECT sysdate - 90); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COPY schema.table ("ts","column_a","column_b") | |
FROM 's3://bucket/prefix' | |
REGION 'us-east-1' /* S3 bucket is in us-east-1 region */ | |
GZIP | |
ESCAPE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNLOAD ('SELECT "ts", "column_a", "column_b" | |
FROM schema.table | |
WHERE ts >= (SELECT DATE_TRUNC(\'day\', (SELECT sysdate - 1))) | |
AND ts < (SELECT DATE_TRUNC(\'day\', (SELECT sysdate)))' | |
) | |
TO 's3://bucket/prefix' | |
GZIP | |
ESCAPE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TRUNC(starttime) AS day, | |
colname, | |
err_reason, | |
filename, | |
line_number | |
FROM stl_load_errors | |
WHERE colname = 'err' | |
GROUP BY day, | |
colname, | |
err_reason, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TRUNC(starttime) AS day, | |
colname, | |
err_reason, | |
COUNT(*) AS amount | |
FROM stl_load_errors | |
WHERE starttime >sysdate -1 | |
GROUP BY day, | |
colname, | |
err_reason | |
ORDER BY day, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT pid, | |
user_name, | |
starttime, | |
duration, | |
query | |
FROM stv_recents | |
WHERE status = 'Running' | |
ORDER BY user_name DESC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo ip link set dev eth0 mtu 1500 |