Speedment Open Source transforms Stream operations into corresponding SQL statements, allowing you to express database queries in a type-safe and declarative style. This works well for smaller applications where performance is not an issue. Speedment will analyze the stream to optimize the statements if possible, but you will always be limited to the performance of the database.
As the application grows and performance becomes more important, you might want to consider enabling the Speedment Enterprise Datastore. It will download the database data once, organize it in-memory in a very efficient structure and then use this in-memory cache when streaming. Whenever the data changes in the database, the store can be updated using a single line of code and without any downtime. Speedment Enterprise allows you to configure exactly which tables and columns to cache in the graphical tool, allowing you full control of the memory usage.
For even larger applications where the data streamed stretches beyond the limitations of the server's RAM, we have a number of techniques in our catalog. Less used tables can be stored in memory-mapped files. Speedment can also be clustered to utilize the combined memory of multiple machines.