-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Process record summaries in DB layer #3561
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make it easier to add new SQL files to the installation process.
seancolsen
force-pushed
the
record_summaries_in_db
branch
from
May 9, 2024 01:58
3aa2736
to
b2aceb1
Compare
@mathemancer this is ready for a proper review now. |
Oh I also meant to mention that I rebased this on top of #3556 — but only for the sake of convenience during development (so that I could see/run/copy your tests in that PR). I can rebase this back on another branch if you prefer. |
Example of transitive record summaries: SELECT *
FROM msar.get_record_summaries(
'"Checkouts"'::regclass::oid,
array[1896],
'[
"[", [1], "]: ",
[3,2], " ", [3,3],
" checked out ",
[2,2],
" (", [2,5,2], " by ", [2,5,10,2], " ", [2,5,10,3], ")"
]'::jsonb
);
|
7 tasks
Closing because I'm re-doing this in a newer PR |
seancolsen
added a commit
that referenced
this pull request
Oct 23, 2024
seancolsen
added a commit
that referenced
this pull request
Oct 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before reviewing this PR, make sure you're familiar with the Propose changes to record summaries for beta.
Examples
These examples use the Library Management data, with the following id values:
"Books"
(oid:36147
)"Title"
(attnum:2
)"Author"
(attnum:10
)"Authors"
"First Name"
(attnum:2
)"Last Name"
(attnum:3
)Auto-generated Books summaries
Manually-templated Books summaries
Thoughts
I feel the least confident about the implementation within
get_record_summaries_via_query
. Very much open to different approaches there, including changing the approach of passing id values in via array.On a similar note, I wrote a test
__SKIP__test_record_summary_performance
. This is skipped because it's failing. The intent of this test is to verify that we're only generating record summaries for the records passed in via the array. But... (sad trombone)... it doesn't actually work like I thought it would. My next step here is to dig into EXPLAIN to get a better sense of the query plan. I thought Postgres would be smarter here, but oh well.This empirical evidence does make me question my original premise with this design. I was hoping that we'd be able to define a bespoke record summary query for a specific table — devoid of any filtering — and then use that at the inner layer to compose the filtered query using application-defined logic. Alas, it may be that the bespoke queries actually need to be aware of the filtering. I'd like to experiment with this more and bounce some ideas around with you.
For the time being, this works. But I'd like to eventually make it faster. In theory we could potentially kick that can down the road.
Are there some types which wouldn't be able to cast to TEXT via
cast( v AS text )
? I don't understand enough about how this works in Postgres. It seems like there is a difference between implicit casting and explict casting, or something like that. I did a little research but didn't find the answers I was looking for. I did write a testtest_record_summary_with_no_text_columns
, which asserts that we can auto generate record summaries for a table having onlyuuid
andpoint
column types. This actually led me to make the fix in 9cca125. I'm hoping this will cover all possible types, but I think you would know better.Checklist
Update index.md
).develop
branch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin