db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-481) implement SQL generated columns
Date Fri, 24 Oct 2008 23:43:44 GMT

    [ https://issues.apache.org/jira/browse/DERBY-481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12642572#action_12642572

Bryan Pendleton commented on DERBY-481:

Hi Rick,

I read through the first 4 patches and they look very good to me. Thanks for the
effort in writing the comments and the tests.

I was wondering if you could briefly outline how you expect the execution-time
logic to go: will we generate code to implement the generation expression?
Or will there be some sort of interpreter that runs as part of update processing
and interprets the generation expression?

Also, when are the generated columns evaluated? Is it only when their value
is retrieved by a SELECT? Or is the generated column evaluated whenever
anything that it references is updated?

So for example, if I have:
  create table bry (a int, b int, c int generated always as (2 * b))
then is the value of column c generated:
 - only when c is selected?
 - when the value of b changes?
 - when the value of either a or b changes?



> implement SQL generated columns
> -------------------------------
>                 Key: DERBY-481
>                 URL: https://issues.apache.org/jira/browse/DERBY-481
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions:
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-481-00-aa-prototype.diff, derby-481-01-aa-catalog.diff, derby-481-02-aa-utilities.diff,
derby-481-03-aa-grammar.diff, GeneratedColumns.html
> Satheesh has pointed out that generated columns, a SQL 2003 feature, would satisfy the
performance requirements of Expression Indexes (bug 455). Generated columns may not be as
elegant as Expression Indexes, but they are easier to implement. We would allow the following
new kind of column definition in CREATE TABLE and ALTER TABLE statements:
>     columnName GENERATED ALWAYS AS ( expression )
> If expression were an indexableExpression (as defined in bug 455), then we could create
indexes on it. There is no work for the optimizer to do here. The Language merely has to compute
the generated column at INSERT/UPDATE time.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message