Skip to content

Instantly share code, notes, and snippets.

@benmmurphy
Created April 27, 2015 10:26
Show Gist options
  • Save benmmurphy/da38a21dd33a18527f49 to your computer and use it in GitHub Desktop.
Save benmmurphy/da38a21dd33a18527f49 to your computer and use it in GitHub Desktop.
Redshift Fun
logs=# create table timestamp_test (a timestamp, b timestamp);
CREATE TABLE
logs=# insert into timestamp_test(a,b) values('2015-04-25 06:29:40', '2015-04-25 06:35:36');
INSERT 0 1
logs=# select b-a from timestamp_test where b-a > 3000;
?column?
-----------
356000000
(1 row)
logs=# select b-a from timestamp_test where b-a > 6000;
?column?
----------
(0 rows)
logs=# insert into timestamp_test(a,b) values('2015-04-25 06:13:14', '2015-04-25 06:13:19');
INSERT 0 1
logs=# insert into timestamp_test(a,b) values('2015-04-25 06:13:14', '2015-04-25 06:13:19');
INSERT 0 1
logs=# select b-a from timestamp_test where b-a > 3000;
?column?
-----------
356000000
5000000
(2 rows)
logs=# select b-a from timestamp_test where b-a > 5000;
?column?
----------
5000000
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment