7 ms·
Because it doesn't make a difference, because `SELECT 1` doesn't need to touch the database: Running 100,000 `SELECT 1` queries: PostgreSQL (localhost)
by eurleif 5mo ago
Because it doesn't make a difference, because `SELECT 1` doesn't need to touch the database:
Running 100,000 `SELECT 1` queries:
PostgreSQL (localhost): 2.71 seconds
SQLite (in-memory): 0.07 seconds
SQLite (tempfile): 0.07 seconds
(https://gist.github.com/leifkb/d8778422d450d9a3f103ed43258cc52c https://gist.github.com/leifkb/d8778422d450d9a3f103ed43258cc...)
- oldsecondhand 5mo agoWhy are you doing meaningless microbenchmarks?
- saturn_vk 5mo agoAre you claiming that this does not show the speed difference between socket vs in process communication?
- locknitpicker 5mo ago> Because it doesn't make a difference, because `SELECT 1` doesn't need to touch the database: I hope you understand that your claim boils down to stating that SQLite is faster at doing nothing at all, which is a silly case to make.
- eurleif 5mo agoThe original claim being discussed is about the overhead of an in-process database vs. a database server in a separate process, not about whether SQLite or PostgreSQL have a faster database engine.
- nchmy 5mo agoHow about pg on Unix socket?
- eurleif 5mo agoRunning 100,000 `SELECT 1` queries: PostgreSQL (localhost): 2.84 seconds PostgreSQL (Unix socket): 1.93 seconds SQLite (in-memory): 0.07 seconds SQLite (tempfile): 0.06 seconds (https://gist.github.com/leifkb/b940b8cdd8e0432cc58670bbc0c331e2 https://gist.github.com/leifkb/b940b8cdd8e0432cc58670bbc0c33...)
- nchmy 5mo agoseems about right
- onraglanroad 5mo agoYou appear to have benchmarked how quickly Python can access memory vs how quickly Python can open and close a socket. I'm not sure the DBs were required in any way.
- j45 5mo agoQueries for small SaaS are usually in the thousands of records, if not hundreds.