Skip to content

This repository saves the project of Group 2 , from G4 , DSA.

Notifications You must be signed in to change notification settings

AurindumBanerjee/DSAGroup2-G4

 
 

Repository files navigation

🚀 Optimizing Aggregate Queries in Databases using Segment Trees

Repo Size Stars Forks


📝 Project Overview

This project demonstrates how Segment Trees can be utilized to optimize aggregate queries in a simulated database system. Using B-Trees for CRUD operations and Segment Trees for rapid aggregation, this system efficiently handles queries for operations like SUM, MIN, and MAX, while supporting SQL-like WHERE clauses to add flexibility in query selection.


🔍 Problem Statement

Aggregate queries such as SUM, COUNT, MIN, and MAX are common in databases but can become slow with large datasets if not optimized. This project uses Segment Trees—common in competitive programming for range queries—to speed up aggregate query processing in a database setting. Key components of the project include:

  • Database Simulation: CRUD operations implemented using B-Trees for efficient storage and retrieval.
  • Optimized Aggregate Queries: Standard database queries are optimized with Segment Trees for faster processing.
  • Advanced Querying: Support for SQL-like WHERE clauses to provide flexible selection.

🧠 Key Features

  • Database Simulation: Basic CRUD operations simulated with B-Trees for efficient data handling.
  • Optimized Querying: Segment Trees enable rapid execution of aggregate queries like SUM, MIN, and MAX.
  • WHERE Clause Support: SQL-like filtering with WHERE clauses for flexible query handling.
  • Fast Query Processing: Combination of Binary Search and Segment Trees ensures fast, efficient data processing.

🛠️ Technical Details

Project Structure

This project is organized to simulate a database environment with optimized query execution.

  • CRUD Operations with B-Trees: Implements basic database operations with B-Trees for effective insertion, deletion, and update functionality.

  • Optimized Aggregate Functions:

    • Segment Tree: Builds and maintains a Segment Tree for performing fast aggregate queries, with operations executed in O(log n) time for each segment.
    • Binary Search: Used for quick record retrieval, further enhanced by Segment Trees for range queries.
    • SQL-like WHERE Clause: Adds filtering capability, enabling users to specify conditions, making query handling dynamic and versatile.

Data Structures Used

  • B-Trees: Efficient for CRUD operations, maintaining the simulated database’s records.
  • Segment Trees: The core data structure for efficient aggregate queries over specific ranges.

🚀 How It Works

  1. Creating Data Records: Users add records to the database using the CRUD module.
  2. Executing Queries:
    • Users input optimized aggregate queries, like calculating the SUM or MIN over specified ranges.
    • Queries with a WHERE clause are filtered before aggregation, providing an efficient way to handle conditional queries.
  3. Getting Results: The system provides quick results by leveraging Segment Trees, making the querying experience seamless even with large datasets.

📚 Resources


🔗 Repository

Check out the repository for code and additional documentation: Group2-G4 on GitHub

About

This repository saves the project of Group 2 , from G4 , DSA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%