Learning inside databases
Training data often begins in tables. Bringing a learning calculation close to those tables can spare a large export, but it also requires a way to express iteration and shared model state.

From rows to training examples
Consider a table of ratings with a user, an item and a score in each row. A relational database can join those rows to item descriptions, select a time period and group observations by user. A training table is already the result of choices about missing rows, repeats and which information was available at prediction time.
Moving the full result into a separate program adds a transfer and produces a second copy that must stay consistent with the first. An in-database method keeps more of the work within the engine, where partitioning, joins and aggregation are already available.
- Select examples
- Join features
- Aggregate updates
- Store model values
What a repeated computation needs
A SQL aggregate combines values from many rows. Training can use this pattern when a single pass over rows provides partial quantities that can be merged into an update. The next pass needs the updated model, so the system must also express a sequence of such computations.
The MADlib project described SQL-based algorithms for statistics and machine learning inside a database engine. Its research question included how to design reusable patterns for parallel computations. Avoiding an export is a practical benefit. A particular operation must still suit the database’s execution model to run efficiently.