Jettford / DatabaseTheoryTesting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Effeciency Evaluation

1. Introduction

This project is intended to evalute the effeciency of two different database architectures.

This was motivated by an in-college debate of the two database architectures, and I wanted to see if I could prove one was better than the other.

The two architectures are inside of the tables folder. Use the SQL files student.sql and tutor.sql to create the tables, then populate them with student_and_course_data.sql. (Or use the setup_databases.py script, it might take some messing with to get it to work though)

Once that is complete you can run main.py and it will run some final setup and then a series of queries on both databases and compare the time it takes to run each query.

2. Testing Methodology

The testing methodology is simple. The script will run a series of queries on both databases and compare the time it takes to run each query.

The mock data is generated by (Cobbl)[https://cobbl.io]. The data is generated in a JSON format and then imported into the databases by hand with the generated SQL files in the tables folder.

There are 10000 Students, 100 Courses and with each student enrolling in 1-3 courses. (The figures of how many courses each student are in are random, however will be matching across both databases)

The data fetched in the testing are as follows: - Fetch all courses for a student - Fetch sign-ups for a course on a enrolment date - Fetch all students for a course

And for the unique size of database checking we are using the following query from the MySQL Forums:

SELECT table_schema "Database", ROUND(data_length, 1) "Size (Bytes)" 
FROM information_schema.tables 
GROUP BY table_schema;

3. Results

The results are as follows (times in nano seconds):

    - Database Size:
      - Student: 16384 Bytes
      - Tutor: 16384 Bytes

    - Fetch all courses for a student:
      - Time taken for Student (Average over 100 runs): 319149.0
      - Time taken for Tutor (Average over 100 runs): 438824.0

    - Fetch sign-ups for a course on a enrolment date:
      - Time taken for Student (Average over 100 runs): 1256916.0
      - Time taken for Tutor (Average over 100 runs): 3663611.0

    - Fetch all students for a course
      - Time taken for Student (Average over 100 runs): 2852653.0
      - Time taken for Tutor (Average over 100 runs): 2945956.0

About


Languages

Language:Python 100.0%