SQL Join Size Estimator is a Java-based tool that connects to a SQL database, retrieves table metadata, and estimates join sizes between two user-specified tables. It helps analyze database relationships and assess SQL join efficiency.
- Connects to a SQL database.
- Checks table existence.
- Retrieves table schema.
- Identifies common columns.
- Estimates and computes join size.
- Calculates estimation error.
- Java 8+
- A SQL database (MySQL, PostgreSQL, etc.)
- JDBC Driver for the chosen database
- Clone the repository:
git clone https://github.com/satwikbhasin/sql-join-size-estimator.git
- Compile the Java files:
javac -cp .:path/to/jdbc/driver.jar SQLJoinSizeEstimator.java
- Run the program:
java -cp .:path/to/jdbc/driver.jar SQLJoinSizeEstimator
- Run the program and enter the names of two database tables.
- The tool will:
- Check if the tables exist.
- Retrieve and display table schema.
- Identify common columns.
- Estimate the join size.
- Compute the actual join size.
- Display the estimation error.
Enter 1st table name: employees
Enter 2nd table name: departments
Table: employees
Columns: id, name, dept_id
Table: departments
Columns: id, dept_name
Common columns: id
Estimated join size: 5000
Actual join size: 4800
Estimation error: 200