Categories
All Softwares
Sublime Text VSCode Binaries Postman TeamViewer Firebase Visual Studio Code Contentful Tribe Circle Notion Datadog NewRelic Vmix Archbee Docker Desktop Bitly GitHub BitBucket Upsource Zapier Make Medium substack Facebook Amazon S3 Maya 3DS MAX Adobe Substance Airtable Roam Research Azure DevOps Retool Powerapps Appsheet 1Password Plex Emby Netflix Apple HomeKit Algolia Lightshot Confluence Toad tableau Data Studio Salesforce SAP Calendly Google photos Bloomberg Terminal BigQuery ML Google AutoML Tables Shopify BigCommerce Google Drive Redis Memcached Windows media player WhatsApp Heroku Render Looker Quizlet Google Analytics Auth0 Trello Elasticsearch Adobe Premiere Pro Zerotier Zoom Skype Docker Polypane Google Chrome Microsoft Edge Safari Gitbook Gmail Google Vertex AI Kdb+ Amplitude Google Docs Typora Roboflow ML Kit Azure Intercom Quicken YNAB Uptime Robot Figma npm TigerGraph Amazon Neptune Fivetran Okta YouTube LastPass Mailchimp Sendinblue Adobe Acrobat Pocket Reddit Onenote Shogun DaVinci Resolve UiPath Taliscale Adobe Lightroom FullStory LogRocket RescueTime Boxcryptor LaunchDarkly ArcGIS AWS SageMaker Tailscale NordVPN WooCommerce Twitter Dropbox Nagios Zabbix Prtg Google Cloud Webflow ActiveCampaign Quickbooks .Net Maui Airplane.dev Pipedream Evernote Autodesk AutoCAD HCL Connections Google Sheets Excel Rundeck Ansible Tower Salt Twilio Pastebin Zoho Unity3D GameMaker AWS Config GCP Cloud Asset inventory AWS GuardDuty Unreal Engine (UE4) Jira YouTrack Stytch Suite CRM Greynoise Photoshop LinkTree BlackBoard Zendesk Discord Rollout.io Disqus Oracle Fusion ERP Cloud Odoo Microsoft Dynamics Alfred Sophos Firewall UniFi Security Gateway Azure AD Doodle Office Online Power BI MicroStrategy Qlik Ampache Socrata Drone CI IOS WordPress IDM FDM Ninja Download Manager McAfee Google Meet WIX cPanel LucidChart HubSpot Landbot Typeform CCleaner Ecwid Spotify Stackstrom N8N Substance Painter Onshape SketchUp Canny Miro XMind Segment GoogleForms Adobe Illustrator MultiSim Proteus Prezi Slack Microsoft Teams SumSub JAWS Wetransfer Framer Microsoft 365 Telegram Threema Signal Lokalise Crowdin Phrase WolframAlpha Dataclay Templater Bot WorkOS FrontEgg Snorkel AI ZohoCRM Voicemod Chromatic Percy POEditor Transifex Microsoft Office Selenium vBulletin Xenforo Hightouch Logseq Bundlephobia Webpack Esbuild Rollup Session Berty WHMCS Stripe Billing Google Camera ImgIX Netlify Google Keep SocialPilot Hootsuite Firebase Analytics Access Manager Wordle Amazon Redshift Snowflake Microsoft Active Directory ClubHouse Tenable Nessus Obsidian Scrivener IDA Neo4j Pushbullet Pushover TinkerCAD Fusion360 SolidWorks TablePlus Cryptomator Glasswire Comodo Firewall Coyim Splunk Hungry Bring Panther IFTTT openHAB Alexa Google Home Twitch Asana IBM Watson Discovery FL Studio Ableton Google Maps Gather Aseprite Instagram Agora Wowza Docuware ELO Office Apollo GraphQL Supabase Hasura Stepzen Postgraphile Lyket.dev Kahoot Clubdesk Fairgate Bandicam Revoltchat Element Imply Pinot MongoDB Oracle Peoplesoft CurseForge Google Tag Manager MS SQL AppWrite Nhost AWS Kendra QnA Maker Apigee Google Cloud IoT Core Microsoft OneNote Amazon API Gateway Qualtrics Sprig Hotjar Sibelius Finale Dorico Snyk Common Room Orbit Toggl Track Adobe Scan Microsoft Lens CamScanner Vercel Stack Overflow Traktor Pro 3 Markup CMS Documentation Atlassian Confluence Raindrop Akeneo Salsify Informatica SuiteCRM VtigerCRM Cruise Tesla autopilot Waymo Adobe Animate Pencil2D Men&Mice Solarwinds Infoblox Device42 AWS WAF
TimescaleDB

TimescaleDB

Open Source Alternative to Kdb+
Language
C
Stars
19063
Watchers
19063
Forks
941
Open Issues
577
Last Updated
5/9/2025

REAMDE.md

Timescale logo

TimescaleDB is a PostgreSQL extension for high-performance real-time analytics on time-series and event data

Docs SLACK Try TimescaleDB for free

Install TimescaleDB

Install from a Docker container:

  1. Run the TimescaleDB container:

    docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17
    
  2. Connect to a database:

    docker exec -it timescaledb psql -d "postgres://postgres:password@localhost/postgres"
    

See other installation options or try Timescale Cloud for free.

Create a hypertable

You create a regular table and then convert it into a hypertable. A hypertable automatically partitions data into chunks to accelerate your queries.

-- Create timescaledb extension
CREATE EXTENSION IF NOT EXISTS timescaledb;

-- Create a regular SQL table
CREATE TABLE conditions (
  time        TIMESTAMPTZ       NOT NULL,
  location    TEXT              NOT NULL,
  temperature DOUBLE PRECISION  NULL,
  humidity    DOUBLE PRECISION  NULL
);

-- Convert the table into a hypertable that is partitioned by time
SELECT create_hypertable('conditions', by_range('time'));

See more:

Enable columnstore

TimescaleDB's hypercore is a hybrid row-columnar store that boosts analytical query performance on your time-series and event data, while reducing data size by more than 90%. This keeps your analytics operating at lightning speed and ensures low storage costs as you scale. Data is inserted in row format in the rowstore and converted to columnar format in the columnstore based on your configuration.

  • Configure the columnstore on a hypertable:

    ALTER TABLE conditions SET (
      timescaledb.compress,
      timescaledb.compress_segmentby = 'location'
    );
    
  • Create a policy to automatically convert chunks in row format that are older than seven days to chunks in the columnar format:

    SELECT add_compression_policy('conditions', INTERVAL '7 days');
    

See more:

Insert and query data

Insert and query data in a hypertable via regular SQL commands. For example:

  • Insert data into a hypertable named conditions:

    INSERT INTO conditions
      VALUES
        (NOW(), 'office',   70.0, 50.0),
        (NOW(), 'basement', 66.5, 60.0),
        (NOW(), 'garage',   77.0, 65.2);
    
  • Return the number of entries written to the table conditions in the last 12 hours:

    SELECT
      COUNT(*)
    FROM
      conditions
    WHERE
      time > NOW() - INTERVAL '12 hours';
    

See more:

Create time buckets

Time buckets enable you to aggregate data in hypertables by time interval and calculate summary values.

For example, calculate the average daily temperature in a table named conditions. The table has a time and temperature columns:

SELECT
  time_bucket('1 day', time) AS bucket,
  AVG(temperature) AS avg_temp
FROM
  conditions
GROUP BY
  bucket
ORDER BY
  bucket ASC;

See more:

Create continuous aggregates

Continuous aggregates make real-time analytics run faster on very large datasets. They continuously and incrementally refresh a query in the background, so that when you run such query, only the data that has changed needs to be computed, not the entire dataset. This is what makes them different from regular PostgreSQL materialized views, which cannot be incrementally materialized and have to be rebuilt from scratch every time you want to refresh it.

For example, create a continuous aggregate view for daily weather data in two simple steps:

  1. Create a materialized view:

    CREATE MATERIALIZED VIEW conditions_summary_daily
    WITH (timescaledb.continuous) AS
    SELECT
      location,
      time_bucket(INTERVAL '1 day', time) AS bucket,
      AVG(temperature),
      MAX(temperature),
      MIN(temperature)
    FROM
      conditions
    GROUP BY
      location,
      bucket;
    
  2. Create a policy to refresh the view every hour:

    SELECT
      add_continuous_aggregate_policy(
        'conditions_summary_daily',
        start_offset => INTERVAL '1 month',
        end_offset => INTERVAL '1 day',
        schedule_interval => INTERVAL '1 hour'
    );
    

See more:

Want TimescaleDB hosted and managed for you? Try Timescale Cloud

Timescale Cloud is the modern PostgreSQL data platform for all your applications. It enhances PostgreSQL to handle time series, events, real-time analytics, and vector search—all in a single database alongside transactional workloads. You get one system that handles live data ingestion, late and out-of-order updates, and low latency queries, with the performance, reliability, and scalability your app needs. Ideal for IoT, crypto, finance, SaaS, and a myriad other domains, Timescale Cloud allows you to build data-heavy, mission-critical apps while retaining the familiarity and reliability of PostgreSQL. See our whitepaper for a deep dive into Timescale's architecture and how it meets the needs of even the most demanding applications.

A Timescale Cloud service is a single optimized 100% PostgreSQL database instance that you use as is, or extend with capabilities specific to your business needs. The available capabilities are:

  • Time-series and analytics: PostgreSQL with TimescaleDB. The PostgreSQL you know and love, supercharged with functionality for storing and querying time-series data at scale for real-time analytics and other use cases. Get faster time-based queries with hypertables, continuous aggregates, and columnar storage. Save on storage with native compression, data retention policies, and bottomless data tiering to Amazon S3.
  • AI and vector: PostgreSQL with vector extensions. Use PostgreSQL as a vector database with purpose built extensions for building AI applications from start to scale. Get fast and accurate similarity search with the pgvector and pgvectorscale extensions. Create vector embeddings and perform LLM reasoning on your data with the pgai extension.
  • PostgreSQL: the trusted industry-standard RDBMS. Ideal for applications requiring strong data consistency, complex relationships, and advanced querying capabilities. Get ACID compliance, extensive SQL support, JSON handling, and extensibility through custom functions, data types, and extensions. All services include all the cloud tooling you'd expect for production use: automatic backups, high availability, read replicas, data forking, connection pooling, tiered storage, usage-based storage, and much more.

Check build status

Linux/macOS Linux i386 Windows Coverity Code Coverage OpenSSF
Build Status Linux/macOS Build Status Linux i386 Windows build status Coverity Scan Build Status Code Coverage OpenSSF Best Practices

Get involved

We welcome contributions to TimescaleDB! See Contributing and Code style guide for details.

Learn about Timescale

Timescale is PostgreSQL made powerful. To learn more about the company and its products, visit timescale.com.

Categories:
Database