I have a prolog database file with lots of facts knowledge.pl. For example:
father_of(joe,paul).
father_of(joe,mary).
mother_of(jane,paul).
moth
If you are using SWI-Prolog there are several choices:
Searching for prolog persistence I stumped into persistency: a module that at first glance could be useful.
Then there is a library for 'external tables', i.e. stored in files and indexed. You should use that if you have data that doesn't fit in memory, or if loading/saving the entire data set takes too long.
Otherwise, the answer from thanosQR suggest the 'old fashioned' way to handle persistence.