Page MenuHomeSoftware Heritage

Migrate away from temporary tables for read queries
ClosedPublic

Authored by olasd on Jun 4 2018, 8:24 PM.

Details

Summary

To do so, we import a function from a recent version of psycopg2,
execute_values, which can execute queries efficiently with a list of values.

We also scale the cursor back from having things in SQL functions towards having
things inside the db.py database "backend". This will make it easier to iterate,
as we won't have to deploy function changes to twenty different databases.

After these changes, testing the web UI on a physical replica works.

Close T1073

Test Plan

Local integration tests are happy; Navigating the frontend backed by
a physical replica seems to be okay now.

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Cool stuff.

We also scale the cursor back from having things in SQL functions towards having

things inside the db.py database "backend". This will make it easier to iterate,
as we won't have to deploy function changes to twenty different databases.

Quite!

So, now the db module layer has finally a justified existence ;)

sql/upgrades/119.sql
17

Is the todo still useful?

swh/storage/db_utils.py
101

execute_values_generator?

This revision is now accepted and ready to land.Jun 5 2018, 1:21 PM
This revision was automatically updated to reflect the committed changes.