-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize ClickHouse table schemas and indexing (#100)
### TL;DR Optimized ClickHouse table structures for improved query performance and data organization. ### What changed? - Changed order by to include block number, because most queries would be ordering by time (equivalent to block numbers) or fetching a specific block data by number, not by hash - Introduced a `function_selector` column in the transactions table - Indexing every log topic to be able to query based on them ### How to test? 1. Apply the SQL changes to a test ClickHouse instance 2. Verify that the tables are created successfully 3. Insert sample data into each table 4. Run queries using the new indexes and ordering to ensure improved performance 5. Compare query execution times with the previous table structure ### Why make this change? These changes aim to: 1. Enhance query performance by using more appropriate index types (e.g., bloom_filter for hash columns) 2. Improve data organization and retrieval efficiency with updated ORDER BY clauses 3. Enable faster filtering on commonly used columns with additional indexes 4. Support function-based queries in the transactions table with the new `function_selector` column These optimizations will lead to faster data access and improved overall system performance, especially for large-scale blockchain data analysis.
- Loading branch information
Showing
7 changed files
with
38 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters