You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments