Mysql vs postgres code
From GEANT2-JRA1 Wiki
Contents |
[edit]
MySQL vs PostgreSQL benchmark code
[edit]
Installation
You will find some installation hints:
[edit]
Requirements
For running this code you'll need:
- PostgreSQL database / MySQL database
- test database created
- Table (in test database):
CREATE TABLE a (
id INT PRIMARY KEY,
number INT NOT NULL,
category VARCHAR(10),
description VARCHAR(255)
);
- User who has an access for inserting/deleting/selecting data.
- In MySQL do just:
GRANT ALL ON test.a TO username@localhost;
or:
GRANT CREATE,DELETE,DROP,ALTER,SELECT ON test.a TO username@localhost;
- In PostgreSQL do:
create user testuser; grant all privileges on table a to testuser;
- JDBC drivers, e.g.:
- mysql-connector-java-3.1.6-bin.jar
- postgresql-8.0-310.jdbc3.jar
- Java Runtime Environment or Java SDK 1.4/1.5
- Change (in sourcecode) usernames, passwords and number of records to generate (MAX)
- File must be DBTest.java (and be in ./jra1/sqltest/ directory)
- Compile and run:
/projects/dbtest# javac -classpath mysql-connector-java-3.1.6-bin.jar:postgresql-8.0-310.jdbc3.jar:. DBTest.java /projects/dbtest# java -classpath mysql-connector-java-3.1.6-bin.jar:postgresql-8.0-310.jdbc3.jar:. DBTest
See also MySQL vs. Postgres benchmark results
[edit]
Source Code
[edit]
Other
Source code settings:
- if you set DEBUG=false you'll get CSV (comma separated values) file:
test-type, number-of-records, insert, query1, query2, ... , queryN, delete
- all settings are described in the source code
