sqldelight
sqldelight copied to clipboard
Super slow speed on large data set of floating numbers for SELECT operation
SQLDelight Version
1.5.3
Application Operating System
Android
Describe the Bug
Problem
Perfoming the following operation:
Given a dataset of 1000 elements that contain floating numbers, perform SELECT * operation
Takes a huge amount time (>1500 milliseconds), but it shouldn't
Code snippet
CREATE TABLE weatherLog(
id INTEGER PRIMARY KEY AUTOINCREMENT,
temperature REAL,
humidity REAL,
pressure REAL
);
selectAll:
SELECT *
FROM weatherLog;
override suspend fun loadAll() {
weatherLogQueries.selectAll()
}
Performance result
SQLDelight performance screenshot

Why is this a bug
The same operation takes no time on Room. Since both are wrappers over SQLite I expect the results of SQLDelight to be similar to Room. They are similar for strings. But not for real numbers, hence I assume there is a bug
Room performance screenshot

Stacktrace
There are no errors in stacktrace
override suspend fun loadAll() {
weatherLogQueries.selectAll()
}
this isn't running any SQL, it's just creating the query type
so I'm not sure what you're benchmarking
@AlecStrong huh seems like i've missed the execute method for every operation that returns a Query<> object indeed. For some reason i assumed it executes the query automatically when i invoke selectAll(). I'll try that again
@AlecStrong i've replaced it with
weatherLogQueries.selectAll().execute()
And the result is still 7000 milliseconds. The strange thing is this happens only for SELECT *
and only for floating numbers, everything else works just fine
Performance screenshot

:+1: indeed very weird. I can take a look