An update (and look at what is possible) as we move away from pickled blobs and toward JSON data in the Gramps database.
First, @Nick-Hall has already refactored existing JSON methods for converting to and from Gramps objects. This cleaned up the system, made the representation 100% idempotent, and made the conversions much faster than they were.
With this solid foundation, I wrote a db conversion from blob to JSON, and rewrote the access to the database to only use the JSON interface. This in and of itself doesnât do too much (it does clean up a lot of cryptic code that accessed the unpicked array structure, and makes the data much easier to use outside of Gramps).
But the next steps can take advantage of the new data representation. First, we can index on, and provide direct access to, items that previously had to be unpickled and perhaps converted into a Gramps object. This is a gain for some operations. This functionality uses a standard JSONpath interface to access items in the JSON data fields, but only one row at a time.
A next further step could be taken to move this type of JSONpath access to the SQL layer. Moving the JSONpath to SQL doesnât offer a huge gain when operating on data row by row. But allowing SQL to use SELECT, ORDER BY, and WHERE clases on these JSONpaths is a game changer.
Iâm working on a proposal to have some expensive filters (such as âis ancestor ofâ that could return a list of handles) that are first refactored into a single abstract database method (currently called âbusiness logicâ). Nothing would be new here, just a rearrangement of current code.
But, if a low-level database can implement that functionality using the power of SQL (or whatever backend) then we can get huge gains on more operations.
At that point, certain operations in gramps-desktop can be made much much faster. I would imagine some gramplets, like âDeep Connectionsâ could be very fast. But gramps-desktop would still be limited in some ways. For example, it still might not be able to handle very large databases.
But new projects, like gramps-web could. I hope to work with @DavidMStraub to allow it to take full advantage of all of the above.
If you have any questions or comments, let us know.