While I know the focus is on using SWI-Prolog with ODBC databases are you aware of library(persistency): Provide persistent dynamic predicates ?
If you are starting with a clean project and do not need to use an existing database this might be a better option. Using it with Quick load files is a synergistic option. AFAIK all of the data has to be loaded into memory but I have used these with Gigabtyes of data. (ref)
EDIT
So as not to add lots of independent single post I will just let them pile up here as edits. And to make it easier for others to ignore, make use of the Hide Details.
Click on triangle to expand
SWI-Prolog is also provided as a Docker container (ref) but many prefer to either start with SWISH, or just install on their machine.
library(aggregate): Aggregation operators on backtrackable predicates
library(record): Access named fields in a term
Since I have a need to learn more about how to setup Discourse with Docker and this has some connection points with what you are doing, I will be using your document and these in combination.