3 ms·
DB queries do get pre compiled and cached if you use prepared statements. This is why you should always use prepared statements if you can.
by array_key_first 7mo ago
DB queries do get pre compiled and cached if you use prepared statements. This is why you should always use prepared statements if you can.
- kbolino 7mo agoIt is not always necessary to explicitly use prepared statements, though. For example, the pgx library for Go [1] and the psycopg3 library for Python [2] will automatically manage prepared statements for you. [1]: https://pkg.go.dev/github.com/jackc/pgx/v5#hdr-Prepared_Statements https://pkg.go.dev/github.com/jackc/pgx/v5#hdr-Prepared_Stat... [2]: https://www.psycopg.org/psycopg3/docs/advanced/prepare.html https://www.psycopg.org/psycopg3/docs/advanced/prepare.html