Skip to content

Resource embedding on views that don't select keys #2067

Answered by wolfgangwalther
bcb asked this question in Q&A
Discussion options

You must be logged in to vote

So you want to join those two views on the hash_id column?

I see two ways of dealing with this:

  • Either create a hash_id <type> GENERATED ALWAYS AS (id_encode(id, 'salt', 8)) STORED column on both tables, then add indexes and the foreign key relationship to those. This will make embedding work, because you will only select the simple column hash_id from the base table.
  • Or create a computed column for custom embedding as mentioned here: #915 (comment). Note, that you'd very likely still need an index on the id_encode expression, to make the query efficient.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by wolfgangwalther
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question embedding resource embedding
2 participants
Converted from issue

This discussion was converted from issue #2065 on December 03, 2021 08:39.