This is a simple program written in Python that is meant for viewing easily, the performance of both Databases. The language displayed in the program is Spanish, but the whole code is in English, keep that in mind.
Requirements
You don't need XAMPP, the database is online.
You need to install PyMySQL by pip
with pip install PyMySQL
.
Features
It creates three tables:
- Alumno (Student)
- Materia (Subject)
- Calificaciones (Score)
Alumno (Student) table has this structure:
value | type | key |
---|---|---|
id | INT NOT NULL AUTO_INCREMENT | PRIMARY KEY |
nombre | varchar(255) NOT NULL | N/A |
Materia (Subject) has this structure:
value | type | key |
---|---|---|
clave | INT NOT NULL AUTO_INCREMENT | PRIMARY KEY |
nombre | varchar(255) NOT NULL | N/A |
Calificaciones (Score) has this structure:
value | type | key |
---|---|---|
clave_Materia | int NOT NULL | FOREIGN KEY |
id_Alumno | int NOT NULL | FOREIGN KEY |
valor | float NOT NULL | N/A |
It asks you for a number, and shows you that quantity of rows. Also tells you how many records has each table.
As this program is just for checking performance, or for future comparison with MongoDB, the data will be automatically created, by random function. This is it for the three tables. You just need to introduce the number of records you want to store. ACID transactions are considered.
When storage in MySQL has begun, the program will create a .txt file, called 'timesMySQL.txt'. It saves the times when storing data begins, and when it ends.
There are two ways data can be deleted:
- Delete just the data
- Delete data and tables
You cannot choose which record will be deleted, the whole data is deleted.
For obvious reasons, when the second option is chosen, you must re-create the tables, by using the feature Create tables.
This option cancels the execution of the program.
Requirements
Install MongoDB Comunity Edition.
Install MongoDB Compass.
For Python, install PyMongo by pip
with pip install pymongo
Features
Apparently, it only inserts a lot of data.
With MongoDB Compass you can check the performance of the database and compare it with MySQL performance.