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

feat: convert processing, block and message tables to hypertables #111

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

iand
Copy link
Contributor

@iand iand commented Oct 15, 2020

This is a major rework of the database schema and may only be applied
to an empty database. It is not reversible without dropping the schema
and restating.

This change adds a height column to processing, message and actor
tables as part of the primary key and uses it
to partition the table as a timescale hypertable. Rough calculations of
expected number of rows per epoch and row widths are included to estimate
the potential chunk sizes of each hypertable. Timescale recommend that chunks
are small enough that the most recent can fit into 25% of main memory, summed
over all tables.

Additionally the indexes on the visor_processing tables have been analysed to
give the best performance for the work selection queries used by visor. The
tipsets and message processing table indexes fully cover the query so only an
index scan is performed. The actors processing table requires two indexes to
cover the cases where all codes are specified vs zero codes.

Also fixes the sector_id columns for miner_pre_commit_infos, miner_sector_infos and
miner_deal_sectors which were created as autoincrement serials by the go-pg
orm package.

@iand iand force-pushed the iand/processing-partitioning branch 2 times, most recently from 2277493 to 168bdac Compare October 16, 2020 13:02
@iand iand self-assigned this Oct 16, 2020
@iand iand force-pushed the iand/processing-partitioning branch 2 times, most recently from 8ab23e8 to af1bfdb Compare October 20, 2020 15:19
@iand iand changed the title feat: partition processing tables feat: convert processing, block and message tables to hypertables Oct 20, 2020
iand added a commit that referenced this pull request Oct 21, 2020
…g stats table

The processing indexes are very slow to create against populated databases. Remove them
and add them back in as part of a later conversion of the processing tables to
hypertables (see #111)

While we are amending this migration, also change the structure of the visor_processing_stats
table. Fixes #120
@iand iand force-pushed the iand/processing-partitioning branch 8 times, most recently from 2a7bffb to bf26b5b Compare October 21, 2020 16:08
@iand
Copy link
Contributor Author

iand commented Oct 21, 2020

Note that github hides the migration file by default since it is large

@iand iand marked this pull request as ready for review October 21, 2020 16:09
iand added a commit that referenced this pull request Oct 22, 2020
…g stats table (#130)

The processing indexes are very slow to create against populated databases. Remove them
and add them back in as part of a later conversion of the processing tables to
hypertables (see #111)

While we are amending this migration, also change the structure of the visor_processing_stats
table. Fixes #120
@iand iand force-pushed the iand/processing-partitioning branch 2 times, most recently from 8521593 to 8c74514 Compare October 22, 2020 10:10
This is a major rework of the database schema and may only be applied
to an empty database. It is not reversible without droping the schema
and restating.

This change adds a height column to processing, message and actor
tables as part of the primary key and uses it
to partition the table as a timescale hypertable. Rough calculations of
expected number of rows per epoch and row widths are included to estimate
the potential chunk sizes of each hypertable. Timescale recommend that chunks
are small enough that the most recent can fit into 25% of main memory, summed
over all tables.

Additionally the indexes on the visor_processing tables have been analysed to
give the best performance for the work selection queries used by visor. The
tipsets and message processing table indexes fully cover the query so only an
index scan is performed. The actors processing table requires two indexes to
cover the cases where all codes are specified vs zero codes.

Also fixes the sector_id columns for miner_pre_commit_infos, miner_sector_infos and
miner_deal_sectors which were created as autoincrement serials by the go-pg
orm package.
@iand iand force-pushed the iand/processing-partitioning branch from 8c74514 to 3d4befa Compare October 22, 2020 11:13
@iand iand merged commit b34ea84 into master Oct 22, 2020
@iand iand deleted the iand/processing-partitioning branch October 22, 2020 11:20
@iand iand mentioned this pull request Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants