September 18, 2006 at 6:15 am
Well, I agree that there are no X table locks being put on system tables in any case of BEGIN TRAN ; SELECT ... INTO ... since I did actually explicitly write that the locks were key locks...
I did neither write that you cannot create tables while you are S/I in a transaction, I said retrieve something... I even gave the (blocked) example of SELECT * FROM INFORMATION_SCHEMA.TABLES. But if you were to say that no one ever wants to retrieve this information or do similar operations that would block on KEY locks in a system table, then I would agree.
Saying 'never' I still think is best. At least it leads people to think what they are doing (which, regarding DBs, seems to be one thing developers do not do) and which implications their code can have to others work.
P.S Thanx!
September 18, 2006 at 9:22 am
Hi All:
I seemed to start an interesting thread with all kinds of great information. The problem was solved with the use of several inputs. This is what seemed to work. For the move to history without creating duplicates:
insert daily_transactions_hist
select * from daily_transactions
where daily_transactions.transactiondate < dateadd(d, -360, getdate())
and not exists (Select 1 from daily_transactions_hist where daily_transactions.TransactionID = daily_transactions_hist.TransactionID)
Then just a another step in the job that deletes the rows:
use Immedia_Billing
delete daily_transactions where transactiondate < dateadd(d, -360, getdate())
go
Thank you all for the help and assistance
William
September 19, 2006 at 1:52 am
Hello!
Just a quick question. Have you considered partitioning? If your data amout is huge maybe partitioning can offset the extra cost of a complicated query plan? And you could 'drop' your partition from which you moved the data to the history table (if you partitioning is 'daily'). Maybe even most your queries are limited by the time dimension? Then partitioning might even be beneficial for Selects...
Regards,
Hans
September 19, 2006 at 7:36 pm
So you were just kidding when you wrote the following?
During this time you have eXclusive locks on system tables. |
... here's another...
P.S Even when creating temporary tables you lock the system tables. |
Yep, I realize you corrected yourself later.
Ok... (trying to lighten this up a bit ), strangly enough, I absolutely agree with the following statement you made...
At least it leads people to think what they are doing (which, regarding DBs, seems to be one thing developers do not do) and which implications their code can have to others work. |
Had you said something like that to begin with (instead of the "Never" thing and system table locks: things), I'd have taken a bit of a different tact and added the following to boot...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply