-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: support expression-based index columns #24455
Comments
Can virtual computed columns be handled purely during planning? Everywhere you see a virtual computed column |
Yes what Peter just wrote is what I had in mind during the meeting earlier today. |
Oh, I see. Good point! That does seem to simplify things a bit. |
Can you use a virtual computed column in an index? That might add some complexity back. |
The backfiller would have to learn to run the compute expressions. The insert, upsert, update and delete paths must already know how to run compute expressions for the normal (stored) computed columns. |
There is also a question of how index selection would utilize an index on a virtual column. For example, if there is a virtual column |
Andy I don't agree, your numbers point to computed indexes which is unrelated to this issue.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
my mistake--thanks |
@justinj thinks this is now much easier with the improvements to the CBO |
Moving this to optimizer backlog, cc @RaduBerinde / @mgartner |
I did a bit of research of what work would be necessary to support expression-based indexes:
Some aspects would be simplified if we treated the expressions as virtual columns (computed but not stored) throughout the stack, but other aspects would become more complicated (it would be the first non-scannable table column - and the code around different kinds of table columns is already very complex). Overall the amount of work is on the same order of magnitude as partial indexes. |
Tracking this under #9682 and closing this one. |
The computed column RFC included a section on virtual computed columns: columns that aren't stored on disk, but are computed on-demand from the other columns in their table.
These aren't yet supported, though. We should support them.
I wrote a half-complete prototype that materialized virtual computed columns eagerly in
RowFetcher
that was foiled by the lack of access tosql
-homed name resolution code inRowFetcher
, but based on a conversation with @knz, @petermattis and @justinj, it seems like we might be able to avoid materializing the columns until they're actually used in a computation. One way to do this would be to create aLazyDatum
kind of thing that doesn't get populated until it's evaluated, but I'm sure there are complications with that as well.The text was updated successfully, but these errors were encountered: