Replies: 1 comment 2 replies
-
|
The business logic that would be a set "proximity" lookups for a Person or a Family. find all the Families where: And an option to find a list of particular secondary object types under those, no matter how deep. So, for a by a Person events (and their Spouse-level family events) or a Family.
Because efficiently finding such subsets as a prefilter can reduce what an un-optimized Custom Filter reviews from tens of thousands of objects to mere dozens. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Gramps has always had a firm line separating so-called "business logic" from the database layer. What do I mean? Take for example this method to get a person's parent's handles:
This takes a bit of processing, looking in different places to find all of the parent handles. But it is all Python, and doesn't depend on the database except for standard method calls.
Normally, we would say that this has no business being in the database layer because is completely database independent. That is, we only put database access methods in the database. Like
get_person_from_gramps_idand all of the rest of the database methods.But what if the
get_parent_handles()method could be implemented at the database level, for example in SQL? For example:This does what the Python did, but can be executed much faster in SQL. I haven't found many candidates (yet) that are helpful in making gramps faster and more efficient. But I did find two:
get_parent_handles()— returns all parent handles for a person across their parent families.get_child_handles()— returns all child handles for a person across their own families.These are implemented and used in the new Graph Algorithms PRs:
There is one fly in the ointment: these SQL methods can't be used if there is a database proxy (like living or private) in use. So they have to fallback to the python implementation (or implement specialize SQL).
Is it worth moving these from SQL to Python? In my tests, I find different ancestor and descendent algorithms are anywhere from about 5 to 9 times faster. So, yes, in my opinion is is worth it.
Beta Was this translation helpful? Give feedback.
All reactions