node-sqlite3
node-sqlite3 copied to clipboard
The same query runs fine in TablePlus but is incredibly slow with node-sqlite3
Issue Summary
Hi, this is a query, as an example, that runs incredibly slow. In node-sqlite3: 15 seconds!! In TablePlus: 15 miliseconds Whats going on?
SELECT
1 isGroup
, id
, name
, count(i) count
, substr(group_concat(poster_path),1,200) thumb_id
FROM (
SELECT g.id id
, g.name name
, i.id i
, poster_path poster_path
FROM genre g
LEFT JOIN movie_genre j ON g.id = j.genre_id
LEFT JOIN (
SELECT * FROM movie
WHERE deleted IS NULL AND private IS NULL
) i ON i.id = j.movie_id
ORDER BY i.id
)
GROUP BY name
ORDER BY id
LIMIT 1000;
Steps to Reproduce
- Run a similar query with node-sqlite3 and with TablePlus.
Note: The movie table has 2497 rows, the genre table has only 23 rows and movie_genre has 5926 rows.
Version
5.1.6
Node.js Version
16.18.0
How did you install the library?
npm, Mac Ventura, 2,8 GHz Intel Core i5