Re: Caching in the dynamic database

Michael Ben Yosef <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABnaNcpeCpCX6oUBvNP325mrKeBtKOGJVZb4d90TK2GoUcL3=w@mail.gmail.com>
Hi Richard,

> Before trying anything exotic, is there any possible
> refactoring of the existing data to take less memory to
> start with?

I must confess I don't have any existing data in mind. I was
considering it as a purely intellectual exercise. That is, suppose we
are working with some data that is definitely larger than memory.
Let's say that it's in the form of an external relational database.
Every time we read from or write to the database we do I/O, possibly
over a network. For many common access patterns it would be much
faster to cache as much as possible of this external database as facts
in Prolog's dynamic database. What I was asking was, "How much is as
much as possible?". For example, if every time I read a row from from
the database I assert a fact for it, how do I know when I'm starting
to fill up memory and I should retract a few lesser used facts before
asserting any new ones?

I suppose it's difficult to understand just what is being allocated
and deallocated as clauses are asserted and retracted (you obviously
understand it much better than most of us do), but as Jan says, this
clause_property/2 option that he's added is a good first step and
allows us to get an idea of how much space our dynamic clauses are
occupying.

Kind regards,

Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.