A modern, high-performance columnar storage database engine built entirely with JavaScript. Features interactive visualizations, real-time query execution, and performance benchmarking.
Open index.html in your browser to explore the interactive interface.
- Columnar Storage Engine: Efficient column-oriented data storage with compression
- SQL Query Engine: Parse and execute SELECT queries with WHERE, GROUP BY, ORDER BY
- Interactive Visualizations: Real-time comparison of row-based vs column-based storage
- Performance Metrics: Comprehensive benchmarking and analytics
- Data Compression: Dictionary encoding, RLE, and delta compression algorithms
- Query Optimization: Predicate pushdown and execution plan visualization
- Modern Design: Brutalist-inspired aesthetic with high contrast and clean typography
- Responsive Layout: Works seamlessly across desktop and mobile devices
- Interactive Charts: Canvas-based performance visualizations
- Real-time Feedback: Live query execution with detailed metrics
- Code Examples: Pre-built query templates for learning
- Frontend: Pure JavaScript (ES6+), HTML5, CSS3
- Visualization: Canvas API for custom charts and storage visualization
- Data Processing: In-memory columnar storage with compression
- Query Parsing: Custom SQL parser supporting common operations
π¦ Column Store Project
βββ π index.html # Main application interface
βββ π styles.css # Distinctive brutalist styling
βββ π js/
βββ π columnStore.js # Core storage engine
βββ π queryEngine.js # SQL parser and executor
βββ π visualizer.js # Storage visualization
βββ π charts.js # Performance charts
βββ π app.js # Application controller
The ColumnStore class implements a high-performance columnar storage system:
class ColumnStore {
createTable(tableName, schema) // Define table structure
insert(tableName, rows) // Bulk insert with compression
scan(tableName, columns, predicate) // Columnar scan with filtering
aggregate(tableName, aggregates, groupBy) // Efficient aggregations
}Key Features:
- Dictionary Encoding: Compresses string columns by mapping values to integers
- Run-Length Encoding: Optimizes repeated integer values
- Null Bitmaps: Efficiently tracks NULL values
- Column Statistics: Maintains min/max/distinct counts for query optimization
- Predicate Pushdown: Filters data at storage level before materialization
The QueryEngine class provides SQL query parsing and execution:
class QueryEngine {
execute(sql) // Parse and execute SQL query
parse(sql) // Convert SQL to query plan
createExecutionPlan(query) // Generate optimization steps
}Supported SQL Operations:
SELECTwith column projectionWHEREclauses with comparison operators (=, >, <, >=, <=, !=)GROUP BYfor aggregationsORDER BYwith ASC/DESCLIMITfor result pagination- Aggregate functions: COUNT, SUM, AVG, MIN, MAX
Real-time visual comparison of storage layouts:
- Row-Oriented: Shows sequential row storage (traditional RDBMS)
- Column-Oriented: Displays columnar blocks with compression indicators
- Canvas Rendering: High-performance custom graphics
- Animated Loading: Smooth transitions and data updates
This project demonstrates proficiency in:
- β Columnar vs row-based storage architectures
- β Data compression algorithms (dictionary, RLE, delta)
- β Query optimization techniques
- β Aggregate function implementation
- β Index and statistics management
- β Object-oriented design patterns
- β Modular architecture with clear separation of concerns
- β Event-driven programming
- β State management in JavaScript
- β Error handling and validation
- β Vanilla JavaScript (ES6+)
- β Canvas API for data visualization
- β Responsive CSS Grid and Flexbox layouts
- β Custom UI components without frameworks
- β Performance optimization
- β Hash maps for dictionary encoding
- β Bitmaps for null tracking
- β Array operations and transformations
- β Sorting and filtering algorithms
- β Time complexity analysis (Big O notation)
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Basic understanding of SQL
- Text editor or IDE
- Clone or Download this repository
- Open
index.htmlin your web browser - Explore the interactive interface!
No build process, dependencies, or server required - everything runs in the browser.
-
Load Sample Data
- Click "Medium (1K rows)" to load the default dataset
- View the storage visualization comparing row vs column layouts
-
Execute Queries
- Navigate to "Query Engine" tab
- Try the example queries or write your own
- View execution plans and performance metrics
-
Analyze Performance
- Visit "Performance" tab
- Compare row store vs column store metrics
- Understand compression ratios and query speeds
SELECT name, department, salary
FROM employees
WHERE salary > 50000
ORDER BY salary DESC
LIMIT 10SELECT department, COUNT(*) AS count, AVG(salary) AS avg_salary
FROM employees
GROUP BY department
ORDER BY avg_salary DESCSELECT *
FROM employees
WHERE department = 'Engineering' AND age > 30- Learn database internals and columnar storage
- Understand query optimization techniques
- Visualize storage architecture differences
- Practice SQL query writing
- Demonstrate full-stack JavaScript skills
- Showcase database knowledge
- Highlight data visualization abilities
- Prove understanding of algorithms
- Explain storage engine design decisions
- Discuss compression algorithms
- Analyze time complexity of operations
- Compare OLTP vs OLAP workloads
- Compression Ratio: 3-10x depending on data type
- String Columns: 5-15x with dictionary encoding
- Integer Columns: 2-5x with RLE
- Memory Usage: 60-80% reduction vs row-based storage
- Column Scan: O(n) with predicate pushdown
- Aggregations: O(n) for simple, O(n log n) for grouped
- Sorting: O(n log n) standard quicksort
- Filtering: Early termination with statistics
- β OLAP (Analytics) workloads
- β Data warehousing
- β Reporting and business intelligence
- β Read-heavy applications
- β Large-scale data analysis
- β OLTP (Transaction) workloads
- β Row-by-row updates
- β Frequent small writes
- β Multi-table joins (not yet implemented)
// Add new compression algorithm
ColumnStore.prototype.addCompression = function(type, algorithm) {
this.compressions.set(type, algorithm);
}
// Add new aggregate function
QueryEngine.prototype.computeAggregate = function(rows, column, func) {
switch(func) {
case 'MEDIAN': return this.calculateMedian(rows, column);
// ... add more functions
}
}// Example JOIN implementation
class JoinExecutor {
hashJoin(leftTable, rightTable, leftKey, rightKey) {
// Build hash table on smaller table
// Probe with larger table
// Return joined results
}
}// Use IndexedDB for persistence
class PersistentColumnStore extends ColumnStore {
async saveToDisk() {
// Serialize columns to IndexedDB
}
async loadFromDisk() {
// Deserialize from IndexedDB
}
}- Brutalist Aesthetic: Raw, functional, high-contrast design
- Typography: Distinctive font pairing (Crimson Pro + JetBrains Mono)
- Color Palette: Dark background with neon green accents (#00ff88)
- Grain Texture: Subtle noise overlay for depth
- Geometric Layouts: Clean grids and asymmetric compositions
- Progressive Disclosure: Start simple, reveal complexity gradually
- Immediate Feedback: Real-time updates and animations
- Educational Focus: Clear explanations and visualizations
- Performance First: Optimized rendering and data processing
- Clean, professional code structure
- Comprehensive documentation
- Interactive live demo
- Performance benchmarks
- Visual design that stands out
- Real-world problem solving
- Scalable architecture
- Custom data structures
- Algorithm implementation
- Query optimization
- Data compression
- Visualization techniques
- Error handling
- Code organization
- Clear README
- Code comments
- Example usage
- Architecture diagrams
- Learning objectives
- Extension ideas
- "I implemented a columnar storage engine to understand OLAP optimization"
- "The compression algorithms reduce memory by 5-10x depending on data type"
- "Dictionary encoding is particularly effective for low-cardinality string columns"
- "Predicate pushdown filters data before materialization, reducing I/O"
- "Column statistics enable query optimization without full scans"
- "The architecture supports parallel scanning of independent columns"
- "I used modular design with clear separation between storage, query, and UI layers"
- "The Canvas API provides high-performance custom visualizations"
- "Event-driven architecture keeps the UI responsive during data operations"
This project is created for educational and portfolio purposes. Feel free to use, modify, and build upon it.
Inspired by modern columnar databases:
- Apache Parquet
- Apache Arrow
- ClickHouse
- Amazon Redshift
- Google BigQuery