Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with time-series data and indexes #245

Open
georgolden opened this issue Jul 20, 2022 · 0 comments
Open

Working with time-series data and indexes #245

georgolden opened this issue Jul 20, 2022 · 0 comments

Comments

@georgolden
Copy link
Member

georgolden commented Jul 20, 2022

Is your feature request related to a problem? Please describe.

We have schema of a kind Journal. It supposes to handle time-series data (logs). This is a useful feature to have out-of-box.

Solution

Kind Journal needs to be handled with creation of an index for time-series data.
There must be queries example of it.
For easier scalability, it makes sens to implement TimeScale Db extension support.

To-Do

  • clone this repo, run a container or standalone Postgres instance, setup database
git clone git@github.com:metarhia/metasql.git
cd metasql
npm ci
cd db

# optional
sh docker.sh

sh setup.sh
npm t
  • create a test Journal schemas
    Example of schema:
// YourSchema.js
({
  Journal: { timescale: true },

  data: 'json',
});

This will contain now fields:

{
  kind: 'journal',
  name: 'YourSchema',
  fields: {
    data: { type: 'json', required: true },
    // this field automatically adds now
    yourSchemaId: { type: 'string', required: false, note: 'Auto-generated primary key },
    // this field must be added only for kind journal
    datetime: { type: 'datetime', required: false, default: 'now', note: 'Timestamp with time zone' },
  },
}
  • write tests and implement index for time-series data on native Postgres
  • after previous done you can design a scenario, where a developer can use TimeScaleDb extension and implement it's support

This is very early concept and needs to be improved. @tshemsedinov @nechaido please contribute to this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant