Reputation: 273
I have a table that I drop and create an index each day and I have another job that queries this table with an ACCESS
lock.
Sometimes these jobs happen at the same time and then I get the following error:
2641 %DBID.%TVMID was restructured. Resubmit.
I have read in the documentation the following:
Explanation:
A table was changed before a statement that references the table was processed.
(For example, an index may have been added or a field removed.)
Notes:
The statement may not have the intended result because of the change in the table.
Remedy:
Examine the table and resubmit the request.
https://docs.teradata.com/reader/8MhLDQBmL52OycrEKPuGqg/Ju5pqm9uRFO6VziQdcmA6w
I guess this is because the CREATE INDEX
sentence requests an EXCLUSIVE
lock and the SELECT
sentence is queued while the index is created, but when the SELECT
is poped from the queue the table has a different version number and it fails.
Maybe I am completely wrong but,
Is there anyway to avoid this behaviour?
Something in the way of making the SELECT
sentence reevaluate when it gets the chance to get executed.
Thank you!
Upvotes: 0
Views: 1871
Reputation: 2080
It is up to the application to handle the 2641 and resubmit the request. There is no option to have the database do so automatically.
Upvotes: 1