Performance issue after upgrading sqlite-jdbc version from 3.39.4.1 to 3.40.0.0 and onwards
(1) By Mukesh Sharma (mukeshsharma) on 2023-06-12 10:19:42 [source]
Hi,
Actually basic SELECT queries taking too long and queries with multiple operations like JOINS etc hanging infinitely when we have recored around 100K after upgrading sqlite-jdbc version from 3.39.4.1 to 3.40.0.0 and onwards ..
Thanks,
(2) By Chris Locke (chrisjlocke1) on 2023-06-12 10:36:59 in reply to 1 [link] [source]
Where did you download the driver from?
Have you raised an issue on the Github issues page?
https://github.com/xerial/sqlite-jdbc/issues
While the driver uses the SQLite library, the driver is not maintained by the SQLite developers - they're separate projects.
(3) By Mukesh Sharma (mukeshsharma) on 2023-06-12 11:34:39 in reply to 2 [link] [source]
Hi Chris,
Thanks for your quick response .
We are using it as maven dependency https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc though we have tested it with jar from maven as well from https://jar-download.com/artifact-search/sqlite-jdbc , so having same problem with both sources.
So you mean , i need to raise new issue to https://github.com/xerial/sqlite-jdbc/issues ?
(4) By Stephan Beal (stephan) on 2023-06-12 12:47:12 in reply to 3 [link] [source]
So you mean , i need to raise new issue to https://github.com/xerial/sqlite-jdbc/issues ?
Yes. If you can demonstrate regressions using the sqlite C library or CLI app, this is the proper forum, otherwise such reports belong with the maintainers of the corresponding wrapper.
(5) By jose isaias cabrera (jicman) on 2023-06-12 13:41:18 in reply to 1 [link] [source]
Hi Mukesh.
...after upgrading sqlite-jdbc version from 3.39.4.1 to 3.40.0.0 and...
Do you know if the sqlite-jdbc driver version is based on the SQLite versions? In other words, does the sqlite-jdbc 3.39.4.1 was based on SQLite v3.39.4? If so, there were a few issues with SQLite v3.40.0 and they were JOIN related. The only way I know is because I had a problem with that version. My suggestion is to take a look at this post and start from there. The sqlite-jdbc driver may gain some speed back by updating to SQLite v3.42.0.
(6) By Mukesh Sharma (mukeshsharma) on 2023-06-13 10:00:08 in reply to 5 [link] [source]
Hi Jose,
Thanks for your input.
The sqlite-jdbc driver may gain some speed back by updating to SQLite v3.42.0.
-> I tried the version 3.42.0.0 as the core problem was for us to fix the vulnerability https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-32697 hence upgraded sqlite-jdbc version from 3.39.4.1 -> 3.42.0.0 but at the same time we tested all the versions > 3.39.4.1 and found that queries are hanging infitely.
(7.2) By jose isaias cabrera (jicman) on 2023-06-13 19:26:56 edited from 7.1 in reply to 6 [link] [source]
I suggest to take out the sqlite-jdbc driver out of the equation: download the CLI tool; connect to the DB and try the query on the CLI. If you can replicate the same issues, response and hanging with the CLI tool, then you can post the query here and the forum and the developers can provide support. Ihth.
(8) By Mukesh Sharma (mukeshsharma) on 2023-06-21 22:58:08 in reply to 7.2 [link] [source]
Hi Jose, We were able to test with the CLI versions of SQLite and it appears to be an issue here rather than the driver. Firstly my machine has already got an installed version SQLite version “3.39.5 2022-10-14 20:58:05” But I also had a previous download of sqlite-tools-osx-x86-3380200 (and running ./sqlite3 it displays “SQLite version 3.38.2 2022-03-26 13:51:10"). And I downloaded the latest version, sqlite-tools-osx-x86-3380200 where running ./sqlite3 it displays “SQLite version 3.42.0 2023-05-16 12:36:15”. In the first 2 commands, when we run our select (all against the same .db file) it completes within 20 seconds and returns 230k records. However when we run the same select with sqlite 3.42.0, the select was running for a minute at least before I cancelled it, and it had only generated 1274 records in the txt file by then. These did match the initial rows in the larger result so the query is technically running rather than hanging, but just at an extremely slow rate in comparison. On the download page for SQLite I cannot see options to download the versions in between the ones Ive tested, but with the sqlite jdbc driver we could test multiple versions to pinpoint its jar upgrade from 3.39.4.1 to 3.40.0.0 being problematic. On its releases page - https://github.com/xerial/sqlite-jdbc/releases, it confirms that that jar includes the upgrade of SQLite to 3.40.0 where you mentioned having issues previously so we can look more in detail at the link you sent as well. SQLite’s own release page - https://www.sqlite.org/changes.html only shows up to 3.39.4 before that release, so Im assuming there is nothing between our CLI tested 3.39.5 and 3.40 we tested with the driver. Are the other pages where we can download the multiple older versions of sqlite tools to confirm it on CLI? Although it is too long to complete on 3.42, we might be able to test if results did return slightly faster than 3.40 of anything between it and 3.39.5. Regarding the query itself, it would be treated as confidential information and cannot be provided, particularly as it ran in previous versions.
(9) By Stephan Beal (stephan) on 2023-06-22 07:59:18 in reply to 8 [link] [source]
Regarding the query itself, it would be treated as confidential information and cannot be provided...
Queries which demonstrate performance regressions are always treated with priority, but without a way to reproduce the regression, there's little which can be done about it. If you can demonstrate an equivalently-failing query, perhaps with randomized or anonymized data and an equivalent schema, you can be sure that it will be looked into promptly.
Alternately, professional support is available, which provides confidentiality of any database you share with the sqlite developers for evaluating such problems.
(10) By jose isaias cabrera (jicman) on 2023-06-22 14:28:44 in reply to 8 [link] [source]
Hi Mukesh.
However when we run the same select with sqlite 3.42.0, the select was running for a minute at least before I cancelled it, and it had only generated 1274 records in the txt file by then.
Well, you have found something that appears to be not right with versions 3.40.x, 3.41.x and 3.42.0.
One more suggestion: If you know how to do it, I would do one more thing: try to build the CLI with the trunk and test against it. This is not released as v3.43.0 yet, but it's being worked. If that also displays the same slowness, then you would need to provide a sample script to the development so they can see where the problem is. Or, you can work with them to provide the DB and the set of commands that cause the unwanted situation. I can tell you that my problem was fixed with 3.42.0, and I am now using the pre-release 3.43.0 which has also fixed other slowness that I did not bother to report. I hope this guides you some. I wish wisdom in your decision.
(11) By stephens on 2023-07-03 12:37:54 in reply to 10 [link] [source]
Hi Jose, I'm working with Mukesh and I was able to compile the latest against the zip from the instructions here: https://sqlite.org/src/dir?ci=trunk.
Release 3.43 with the commits up to 30th June still show the same delays for us. Sorry about the delayed response in testing this but for now we will look into randomizing data as you and Stephan Beal said in the other reply.
I'll get back to you once we have data that everyone can test with to see the differences.
(12) By stephens on 2023-07-06 16:37:57 in reply to 11 [link] [source]
I've uploaded the db and query as a zip to the following link that you should be able to access (I couldnt see where to attach it here): https://ibm.box.com/s/xrd9v479m2omdmxmxnhe90gdp6qz9lj0
I have tested the anonymized data on commandline. The oldest version I had was SQLite version 3.38.2 2022-03-26 13:51:10. It took about 35 seconds to run and generated a file over 1 GB due to the way the data was converted. With the real data it returned less and a bit faster, but for the purpose of this investigation it still finished relatively fast.
The latest version I tested was SQLite version 3.42.0 2023-05-16 12:36:15, although 3.40 release as I mentioned before should see the same delays. The same query on the same db linked, ran for nearly 8 mins before I killed the job. By that point it had only generated a 70.5MB output file (with the same content so far).
Let us know if there is any issue reproducing the issue with this content. Otherwise I look forward to hearing about any issues you can find.
(13) By stephens on 2023-07-18 15:33:35 in reply to 12 [link] [source]
Hi, just bumping this up to get an update if anyone has had a chance to review...
(14.1) By Stephan Beal (stephan) on 2023-07-18 15:48:04 edited from 14.0 in reply to 13 [link] [source]
Hi, just bumping this up to get an update if anyone has had a chance to review...
This probably fell through the cracks because of the reference to JDBC in the subject (which is not maintained here). The link you posted is currently stale. Can you please post a new link?
Edit: nevermind! Dan had a copy locally.
(15) By stephens on 2023-07-19 10:59:40 in reply to 14.1 [link] [source]
Thanks! Just in case here is a fresh link that has an extended time limit: https://ibm.box.com/s/ngqjpkjk3ixbcajz6hjr74g46d69qsgc
(16) By Stephan Beal (stephan) on 2023-07-19 11:36:25 in reply to 15 [link] [source]
Just in case here is a fresh link that has an extended time limit:
Please try out src:76152ad2ffe56034 or later (the current trunk) and let us know if that resolves the problem for you.
(17) By stephens on 2023-07-25 09:56:46 in reply to 16 [link] [source]
Thanks Stephan, this is looking good!
I pulled the very latest - commit 80927c3913561dddf75cf73be871d93ae06b16f83e8cc36fc360765014209615 from yesterday and tested with that. I got the correct result in approx 18 seconds. I think the previous working test on 3.38 version was about 26 seconds so its a bit quicker now too.
We had already created an extra temp table to get by on 3.42 but we will keep an eye out for new jars that will include this fix for the extra performance improvements. Hopefully these changes can make it to 3.43 official release.
Thanks again, we can close this I think.
(18) By summarity on 2023-08-25 00:23:24 in reply to 16 [link] [source]
Just as a heads-up, through a long bisect process, I can now confirm that I'm running into what seems to be another problem caused by this change: https://www.sqlite.org/cgi/src/info/609fbb94b8f01d6792e5941ab23ce041313d359f6788c4dde6b1ca749ab49137 - which points back to this thread.
Sadly, unlike the poster above, this regression still exists for me in 3.43 as well as the latest trunk as of a few minutes ago. A single query regresses from ~700ms to ~3000ms.
I'll do my best to provide more info in a separate report.