Home > Archive > SQL Anywhere database > April 2005 > Truncate table problem - Solved









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Truncate table problem - Solved
Alexey Danilov

2005-04-22, 11:23 am

Hello, All!
Mery thanks to "anil k goal"

After reload DB (and create new DB with rights SYSATTRIBUTENAME)
this Error not Riased!!

PS:Next question :-) what's better "truncate table" or "drop table"?
PPS:Table contain around 700000 rows, 2 FK and 3 index.

With best regards, Alexey Danilov. E-mail: dan@pharm.mos.ru


David Kerber

2005-04-22, 11:23 am

In article <629840022@domain>, dan@pharm.mos.ru says...
> Hello, All!
> Mery thanks to "anil k goal"
>
> After reload DB (and create new DB with rights SYSATTRIBUTENAME)
> this Error not Riased!!
>
> PS:Next question :-) what's better "truncate table" or "drop table"?
> PPS:Table contain around 700000 rows, 2 FK and 3 index.


Depends on what you want. Truncate table removes all the data from the
table, but leaves the table itself in the db. Drop table removes the
table itself, so you need to re-create it it you need to continue using
it.

>
> With best regards, Alexey Danilov. E-mail: dan@pharm.mos.ru
>
>
>


--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
anil k goel

2005-04-22, 1:23 pm

Truncate table can be quite fast as long as certain conditions are met:

1. There are no DELETE triggers on the table
2. If the table has a PK/UNIQUE constraint, then all the foreign tables that
point to it are empty, in other words, the primary rows in the table can be
safely deleted.
3. Truncate with auto commit option is turned ON

--
-anil
Research and Development, Query Processing
iAnywhere Solutions Engineering

-------------------------------------------------------------------------
** Whitepapers, TechDocs, bug fixes are all available through the **
** iAnywhere Developer Community at http://www.ianywhere.com/developer **
-------------------------------------------------------------------------

"Alexey Danilov" <dan@pharm.mos.ru> wrote in message
news:629840022@domai
n...
> Hello, All!
> Mery thanks to "anil k goal"
>
> After reload DB (and create new DB with rights SYSATTRIBUTENAME)
> this Error not Riased!!
>
> PS:Next question :-) what's better "truncate table" or "drop table"?
> PPS:Table contain around 700000 rows, 2 FK and 3 index.
>
> With best regards, Alexey Danilov. E-mail: dan@pharm.mos.ru
>



Alexey Danilov

2005-04-25, 3:23 am

Hello, anil!
Thanks for you advice.

ak> 1. There are no DELETE triggers on the table
Yes
ak> 2. If the table has a PK/UNIQUE constraint, then all the foreign tables
ak> that point to it are empty, in other words, the primary rows in the
ak> table can be safely deleted.
any tables do not referrer to these (truncated) tables
ak> 3. Truncate with auto commit option is turned ON
Yes
ak> --
ak> -anil
ak> Research and Development, Query Processing
ak> iAnywhere Solutions Engineering

ak> -----------------------------------------------------------------------
ak> ** Whitepapers, TechDocs, bug fixes are all available through the
ak> ** ** iAnywhere Developer Community at
ak> http://www.ianywhere.com/developer **
ak> -----------------------------------------------------------------------

ak> "Alexey Danilov" <dan@pharm.mos.ru> wrote in message
ak> news:629840022@domai
n...
??>> Hello, All!
??>> Mery thanks to "anil k goal"
??>>
??>> After reload DB (and create new DB with rights SYSATTRIBUTENAME)
??>> this Error not Riased!!
??>>
??>> PS:Next question :-) what's better "truncate table" or "drop table"?
??>> PPS:Table contain around 700000 rows, 2 FK and 3 index.
??>>
??>> With best regards, Alexey Danilov. E-mail: dan@pharm.mos.ru
??>>

With best regards, Alexey Danilov. E-mail: dan@pharm.mos.ru


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com