db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-268) Add Support for truncate table
Date Thu, 18 Nov 2010 20:53:15 GMT

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

Rick Hillegas commented on DERBY-268:

Hi Eranda,

I am not sure where you are in the code now, so I may not be answering your question. If you
can give me more context, I may be more helpful. For TRUNCATE TABLE, the AlterTableNode is
created by the parser. This is the basic processing flow today:

o The parser digests the TRUNCATE TABLE statement and creates an AlterTableNode.

o Then the AlterTableNode is bound. That is, object names are looked up in the system catalogs
(in this case, the named object in question is the table). As necessary, metadata is copied
out of the system catalogs into in-memory structures in the parse tree.

o Then the AlterTableNode is optimized. Since this is a DDL statement, there is nothing to
do during this phase.

o An executable plan is then generated from the AlterTableNode. This phase is called code-generation.
The executable plan is an AlterTableConstantAction.

o At run-time, the AlterTableConstantAction performs the truncation.

Here's what I think the code will end up doing, at a high level:

o At parse time, you will detect the RESTART IDENTITY clause and set some flag in the AlterTableNode.

o At bind time, you will see that flag. That will cause you to look up the column metadata
for the table, find the identity column, then build a TableElementNode which represents the
instruction to re-initialize the identity column.

o At code-generation time, you will turn the TableElementNode into a ColumnInfo which represents
the same information. The TableElementNode is a compile-time structure. The ColumnInfo is
a runtime structure. What you are doing here is translating compile-time structures into runtime

o At runtime, the AlterTableConstantAction will notice the ColumnInfo structure and reinitialize
the identity column.

I hope I am not confusing you by answering the wrong question. Keep asking questions so that
I can better understand what's puzzling you.


> Add Support for truncate table
> ------------------------------
>                 Key: DERBY-268
>                 URL: https://issues.apache.org/jira/browse/DERBY-268
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Lance Andersen
>            Assignee: Eranda Sooriyabandara
>            Priority: Minor
>         Attachments: changes.diff, derby-268-01-ab-enableForInsaneBuilds.diff, derby-268-02-aa-permsTest.diff,
derby-268-03-aa-npe.diff, Derby-268.diff, tests.diff, TruncateConcurrency.java, TruncateConcurrency.java,
> Adding support for truncate table command will aid to portability

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

View raw message