亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

title: postGreSQL 插件 timescaleDB 安裝使用 date: 2019-0

Kylin_Mountain / 3824人閱讀

摘要:基本環(huán)境操作系統(tǒng)安裝安裝和安裝時序數(shù)據(jù)庫插件部署實踐時空數(shù)據(jù)庫德哥官網(wǎng)安裝文檔設置實驗下載測試數(shù)據(jù)創(chuàng)建數(shù)據(jù)庫解壓下載文件創(chuàng)建表結(jié)構(gòu)導入數(shù)據(jù)查詢測試注釋數(shù)據(jù)庫啟動連接數(shù)據(jù)庫創(chuàng)

基本環(huán)境

操作系統(tǒng): centOS 7

postGreSQL : 10

timescaleDB : 1.0 +

postGreSQL安裝

Centos7 安裝Postgresql10.5和PostGIS

timescaleDB 安裝

PostgreSQL 時序數(shù)據(jù)庫插件 timescaleDB 部署實踐 - PostGIS + timescaleDB => PG時空數(shù)據(jù)庫 -- 德哥

官網(wǎng)安裝文檔:

TimescaleDB Docs - Installing

timescaleDB 設置

TimescaleDB Docs - Setting up TimescaleDB

實驗
    -- 下載測試數(shù)據(jù)
    wget https://timescaledata.blob.core.windows.net/datasets/weather_small.tar.gz

    wget https://timescaledata.blob.core.windows.net/datasets/weather_big.tar.gz

    -- 創(chuàng)建數(shù)據(jù)庫
    create database weather;

    -- 解壓下載文件
    tar -zxvf weather_small.tar.gz

    -- 創(chuàng)建表結(jié)構(gòu)
    psql -U postgres -d weather < weather.sql

    -- 導入數(shù)據(jù)
    psql -U postgres -d weather -c "COPY conditions FROM weather_small_conditions.csv CSV"
    psql -U postgres -d weather -c "COPY locations FROM weather_small_locations.csv CSV"


    -- 查詢測試

    SELECT * FROM conditions c ORDER BY time DESC LIMIT 10;


    SELECT time, c.device_id, location,
    trunc(temperature, 2) temperature, trunc(humidity, 2) humidity
    FROM conditions c
    INNER JOIN locations l ON c.device_id = l.device_id
    WHERE l.environment = "outside"
    ORDER BY time DESC LIMIT 10;


    SELECT date_trunc("hour", time) "hour",
    trunc(avg(temperature), 2) avg_temp,
    trunc(min(temperature), 2) min_temp,
    trunc(max(temperature), 2) max_temp
    FROM conditions c
    WHERE c.device_id IN (
        SELECT device_id FROM locations
        WHERE location LIKE "field-%"
    ) GROUP BY "hour" ORDER BY "hour" ASC LIMIT 24;


注釋

-- 數(shù)據(jù)庫啟動
systemctl start postgresql-10

-- 連接數(shù)據(jù)庫
psql

-- 創(chuàng)建數(shù)據(jù)庫
CREATE database weather_big;

-- 創(chuàng)建時序關(guān)系
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

-- 導入數(shù)據(jù)
psql -U postgres -d weather_big < weather.sql
psql -U postgres -d weather_big -c "COPY conditions FROM weather_big_conditions.csv CSV"
psql -U postgres -d weather_big -c "COPY locations FROM weather_big_locations.csv CSV"


歡迎大家關(guān)注 http://pnunu.cn/

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://www.ezyhdfw.cn/yun/39034.html

相關(guān)文章

  • k8s與監(jiān)控--prometheus的遠端存儲

    摘要:所以采用作為整個集群的監(jiān)控方案是合適的??梢赃^濾需要寫到遠端存儲的。配置中,在的聯(lián)邦和遠程讀寫的可以考慮設置該配置項,從而區(qū)分各個集群。目前支持方案支持高可用。目前我們的持久化方案準備用。 prometheus的遠端存儲 前言 prometheus在容器云的領(lǐng)域?qū)嵙ξ阌怪靡?,越來越多的云原生組件直接提供prometheus的metrics接口,無需額外的exporter。所以采用pro...

    alighters 評論0 收藏0
  • 想熟悉PostgreSQL?這篇就夠了

    摘要:它在其他開放源代碼數(shù)據(jù)庫系統(tǒng)和專有系統(tǒng)之外,為用戶又提供了一種選擇。將插入空間以填補任何額外的空間。始終被視為唯一值上述兩個約束的組合。表范圍的約束可以是,,或。如何在中創(chuàng)建表我們將創(chuàng)建一個名為的表,它定義了各種游樂場設備。 歡迎大家前往騰訊云+社區(qū),獲取更多騰訊海量技術(shù)實踐干貨哦~ 本文由angel_郁 發(fā)表于云+社區(qū)專欄 什么是PostgreSQL? PostgreSQL是自由...

    DTeam 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<