Closed Jammy2211 closed 9 months ago
This is in part due to the number of objects in the database. There are 432259 objects. We create a graph where an object is joined to its parent (e.g. a mass profile to a galaxy) using a foreign key. Normally this is made more efficient by adding an index on the foreign key and the primary key (e.g. the mass profile's parent id and the galaxy's id) so that they can be joined more efficiently.
When using Postgres SQLAlchemy does this implicitly. However, in the database file you sent these indexes are not defined. It looks like they can be force created by changing the SQLAlchemy code that creates the column.
In the mean time, you can test what difference this makes by creating indices yourself:
sqlite3 base.sqlite
CREATE INDEX idx_parent_id ON object(parent_id);
CREATE INDEX idx_object_id ON object(id);
CREATE INDEX idx_value_id ON value(id);
I didn't do a before test but running after these changes the script finishes in a reasonable length of time (albeit with an unrelated error).
I have uploaded a database from lensing analysis here:
https://drive.google.com/file/d/1AYB6j1jBjEgHNa0g1fvVInY0Accy5dk4/view?usp=sharing
I have tried to do a few simple operations:
However, this took over 20 minutes to run!
I suspect this is because the model is a a list-based model with many components (e.g. https://github.com/rhayes777/PyAutoFit/issues/925), as I think run times have been okay for much simpler models.