Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pablodz/10bb0343d820bd82021d6e1d305ef751 to your computer and use it in GitHub Desktop.

Select an option

Save pablodz/10bb0343d820bd82021d6e1d305ef751 to your computer and use it in GitHub Desktop.
# First enter a postgres command line
sudo -u postgres psql
# In postgres command line create a standard table
CREATE TABLE conditions (
time TIMESTAMPTZ NOT NULL,
location TEXT NOT NULL,
temperature DOUBLE PRECISION NULL,
humidity DOUBLE PRECISION NULL
);
/* CONVERT TABLE
* TO HYPERTABLE */
SELECT create_hypertable('conditions', 'time');
/* ADD SOME RANDOM
* DATA */
INSERT INTO conditions(time, location, temperature, humidity) VALUES (NOW(), 'office', 70.0, 50.0);
\q
# \q is to exit postgresql command line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment