I have a Java application that parses files and stores the data I need in a SQLite database.
I'm trying to have it store the data in a remote MySQL database that is on my hosts' server instead.
I rewrote the queries that had a different syntax, but I still have a problem: it's going way slower than when I do it locally using a SQLite database. Is it something I have to live with since one is local while the other is a remote connection, or is there something I should know before continuing?
As an example, parsing 636 files and storing all the data I need (some of the data is useless, I have to sort some of it, etc.) takes 2.5 minutes when I use the SQLite database. That's about 4.24 files per second. On average, it takes about 15 seconds per file when I'm using the MySQL database, so it would take about 63 times longer using the MySQL database.
What I think the main problem might be, but I don't know how to solve it: each file has, on average, 190 inserts. Since the files are statistics sheets for a bowling center and each game is a row (60 players per league times 3 games), plus some checks to see if the league exists in the leagues table, schedule, etc., I can't really just make less inserts since all the information is important.
I think it would help a lot if I could group all the inserts for the games part in one big insert, but I have no idea if that's possible / how it's possible / if it's even worth it or if the problem is elsewhere.
I'd like to know if I'm at least on the right track or if I should get used to my application taking that much time to store the data since it is remotely connected.