Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FOLIO statistical codes to determine if this should be a database… #981

Merged
merged 2 commits into from
Jul 18, 2023

Conversation

jcoyne
Copy link
Contributor

@jcoyne jcoyne commented Jul 17, 2023

… type

Fixes #948

@jcoyne jcoyne force-pushed the statistical-codes branch 2 times, most recently from 6659efb to 7b001e4 Compare July 17, 2023 19:20
@jcoyne jcoyne marked this pull request as ready for review July 17, 2023 19:20
ON item.holdingsrecordid = hr.id
ON item.holdingsrecordid = hr.id
-- Instance's statistical code
LEFT JOIN LATERAL jsonb_array_elements_text(vi.jsonb -> 'statisticalCodeIds') uuid_stats_code(id) ON TRUE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you do any performance testing with this approach? It looks like it triggers a relatively high cost function scan, but maybe it's no worse than the rest of this nasty query?

If it's a problem, I guess we'd revert this part of the query and resolve the statistical code names some other way?

Copy link
Contributor Author

@jcoyne jcoyne Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created #987 so that we have some reproducible way to evaluate the performance of query changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed causes the test ./spec/lib/traject/readers/folio_postgres_reader_spec.rb to fail. I will think about another approach.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I was thinking the performance was in the margin of error (although I'm consistently getting timeouts everywhere now).. I was seeing ~45s for main and ~60s for this branch, but smaller time-slices were pretty much identical.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbeer I added a second commit that has the same effect, but relies on a second query rather than adding joins.

@jcoyne jcoyne force-pushed the statistical-codes branch 3 times, most recently from 1ff3c6f to 5a79804 Compare July 18, 2023 16:31
@cbeer cbeer merged commit ac8a89e into main Jul 18, 2023
@cbeer cbeer deleted the statistical-codes branch July 18, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Database records and the SW facet
2 participants