Well there is always this question about the difference between truncate and delete command.
First lets see what happens when u create a table.If you are using oracle 9i or below there is by default 8 blocks that are allocated for that table even if it does not have any data and this size increases by 8 every time. Hence when you populate the table with data that can not be held by these 8 block, next time there is allocation of 8 more block and hence size now becomes 16 block and so on.
But in latest Oracle databases the default size has been made as 0 block for table.
Now lets come to the difference.
When you delete data from the table, data gets lost but size of the table remains the same.
Where as when you are truncate the table, size of the table becomes default size(as discussed above).
Now very critical question is
"truncate is a DDL or DML command"
If you had followed till now what i talked, answer to this question becomes way simple.
Well its a DDL command right?
That's because of the fact that its dealing with size of table.
For all the users doing Real DBA stuff, i meant running oracle on sun Solaris or any other Linux environment,
you can make use of
select * from user_ts_quotas ;
to see size of tables.
No comments:
Post a Comment