#sql

19 bookmarks tagged with #sql · RSS Feed · ← All Tags

Many Small Queries Are Efficient In SQLite

https://www.sqlite.org/np1queryprob.html
N+1 Queries Are Not A Problem With SQLite SQLite is not client/server, however. The SQLite database runs in the same process address space as the application. Queries do not involve message round-trips, only a function call. The latency of a single SQL query is far less in SQLite. Hence, using a large number of queries with SQLite is not the problem.

Maintaining control of our data with personal databases | N=1 (marcua’s blog)

https://blog.marcua.net/2025/01/05/maintaining-control-of-our-data-with-personal-databases
The fundamental problem is that in using most modern consumer-oriented applications, we lose control of the data we share with those applications. In creating documents, writing emails, or tracking our exercise or other activities, we share data with an application that’s useful for a particular purpose, but also allow the data live in a database controlled by the application’s owner. With the data outside of our control, it can then be restricted, lost, leaked, sold, resold, and exploited. The groups that control these databases accrue most of the benefits, and we accrue most of the costs.

Writing Composable SQL using Knex and Pipelines

https://lackofimagination.org/2024/11/writing-composable-sql-using-knex-and-pipelines/
We have used a query builder to programmatically build SQL queries, and by using higher-order functions (functions that take other functions as arguments) and pipelines, we have: Eliminated the need to pass the query object explicitly. Made it easier to add, remove, or rearrange query modifiers without disrupting the overall structure. Improved maintainability and simplified testing since each query modifier function is a self-contained unit that can be reused across various queries and scenarios.

Spock Proxy

http://spockproxy.sourceforge.net
"Spock Proxy supports range-based horizontal paritioning of a large MySQL database. The proxy intercepts SQL queries from the client, sends queries to the correct databases based on how the database is partitioned, then aggregates the results from each database and returns them to the client as a regular MySQL result set. "

The Phrasebook Pattern

http://ootips.org/yonat/patterns/phrasebook.html
Not unlike templates for (X)HTML? "The Phrasebook pattern is a technique to separate expressions in one language (e.g., SQL) from the main code that is written in another programming language (e.g., Perl). This is done by keeping the expressions in a separate file – the phrasebook. Any specific expression is generated by finding the appropriate entry in the phrasebook and substituting application parameters into it. This separation makes maintenance easier both for the main application code and for the foreign language code."