On 2023-01-15 18:06:36 -0500, Thomas Passin wrote:
> You especially want to avoid letting the database engine do full-table
> scans over and over. And you never want to send a lot of rows to
> Python and do post-filtering on them if you can avoid it.

Another thing to avoid: Lots of small queries. If you have the choice
between a single query which returns 10000 rows and 1000 queries which
return on average 5 rows each, the former is almost always much faster.
Each query carries some overhead. This may not be very noticeable with
SQLite (as everything is in the same process), but it becomes more and
more pronounced the farther the database is from the client. For
complicated queries the parsing and planning overhead can also become
significant.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to