简体   繁体   中英

jdbc sqlite performance - queries exceptionally slow

I'm trying to provide users of my java-based software with the option to use sqlite instead the default MySQL because some users don't know what MySQL is, or how to install, or don't want to.

I've got everything working fine with sqlite but the query times are extremely slow. A SELECT query, from within java using jdbc takes at least three times as long to return results than when using MySQL.

However, the same query run directly in the sqlite console works within milliseconds. It's got to the be the jdbc connection that's causing the slowdown.

Any suggestions on what I can do to improve the speed? I've heard about replacing the drivers with the Xerial versions but am not certain how to do that. I'd do that for testing but that's obviously something I doubt we can ask our users to do - if they're against installing mysql they're not going to want to switch drivers for sqlite...

Your driver should be typically installed with your program distribution. (the same way you wrap sqlite with your application) This way the driver is transparant for your user (he/she doesn't know what happens behind the scenes) and you can use the other driver.

It seems a bit strange that a driver that is bundled with a certain rdbms would be exceptionally slow btw. You could try going through the sqlite logs to see what happens behind the scenes. (I would even recommend it)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM