-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
Milestone
Description
I've noticed that large queries are significantly slower via ecto_sqlite3 than through the sqlite3 CLI when using Ecto or Exqlite.Connection (not with Exlite.Sqlite3)
Here is the example data of ~650k rows: dev.db.zip
Via SQLite3 CLI or any other SQLite3 GUI (with wal mode enabled):
sqlite> .timer on
sqlite> SELECT transaction_date, transaction_amount FROM transactions;
Run Time: real 2.680 user 0.423684 sys 0.323269
sqlite>
With Exqlite.Connection: 21.98 s
{:ok, db} =
DBConnection.start_link(Exqlite.Connection,
database: "./dev.db",
journal_mode: :wal,
cache_size: -64000,
temp_store: :memory
)
{:ok, _, result} =
DBConnection.execute(
db,
%Exqlite.Query{
statement: "SELECT transaction_date, transaction_amount FROM transactions"
},
[]
)Name ips average deviation median 99th %
exqlite_connection 0.00005 K 21.98 s ±0.00% 21.98 s 21.98 s
Same with Ecto : 21520.2ms
Ecto.Adapters.SQL.query(
Repo,
"SELECT transaction_date, transaction_amount FROM transactions"
)[debug] QUERY OK db=21520.2ms decode=1.4ms idle=106.7ms
SELECT transaction_date, transaction_amount FROM transactions []
Any idea what this could be caused by and how to debug it further?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested