truncate table taking very long time, is it normal?

truncate table taking long time oracle
truncate table takes long time sql server
drop table taking long time oracle
drop table taking too long
postgresql truncate table takes too long
galera truncate table
truncate huge table sql server
truncate large table mysql

I am using truncate table table_name; on a table with around 1 million rows, but it's been taking too long, running since last 3 hours.

Is it normal? Can you suggest some other way to delete all rows from a table, which could be faster?

Truncate wont work in some cases such as ,

when you have index kind of things and some foreign key constraints

Easy way i suggest is

RENAME TABLE table_name TO t1;

CREATE TABLE table_name LIKE t1;


or you can also use DELETE FROM table_name;

truncate table taking very long time, is it normal?, Jul 09, 2012 : What can cause TRUNCATE TABLE to take a really long time? the general reasons for a query unexpectedly taking longer than usual to run are:​. When it gets to Truncating Table it seems to take ages (roughly as long as the write process for each table). In the text from the log below, you can see it took over an hour to truncate the table. Truncating a table should be almost instantaneous.

I believe deadlock occurs during your query execution, so it's better to kill it .

I used to delete lots of data, by deleting small chunk in a single query (10k works fine).

So you might write some script which will do this for you.

TRUNCATE TABLE statement sometimes hangs, DROP TABLE and TRUNCATE takes long time to execute in PostgreSQL. I'm trying to delete a table and create them again in PostgreSQL, but, in more than in order to segregate the quality of a classifier to be bad, fair, good, very good or  Truncate partition is very slow, while truncating partition other seesions which are trying to SELECT/DML from this table goes into some kind of wait and takes longer time. Could you please explain why truncate partition takes more time (some time it takes more than 10 minutes). How we can spped up this process. Thanks Kapil

Given issue is logged in mysql repo. For more details visit

In my case, I was trying to trucate table using JDBC But due the above i was not able to do that. So was going through below alternative.

    String createTmpTable = "create table tmp_" + tableName + " like " + tableName;
    String dropTable = "drop table " + tableName;
    String reCreateTable = "create table " + tableName + " like tmp_" + tableName;
    String droptmpTable = "drop table tmp_" + tableName;

DROP TABLE and TRUNCATE takes long time to execute in , Truncate Table Command taking too long a time. Please let me know alternative ways of optimizing. Table contains 1 Lakh Records. Thanks,. postgres truncate is slow. In postgres 9.2 (CentOS), TRUNCATE TABLE command occasionally took a really long time to run. One time, it took more than 1.5 hours to truncate a table with 100K records, even longer in other cases. This problem also happened when I used pgAdmin to truncate table.

Truncate Table Taking too Long a Time - MSDN, I found that H2 takes about 10 minutes to drop such a large table. I looked back at my work on this some months ago, and actually it was with TRUNCATE TABLE But that would sacrifice performance for normal operations because it would  I am using truncate table table_name; on a table with around 1 million rows, but it's been taking too long, running since last 3 hours. Is it normal? Can you suggest some other way to delete

Performance: DROP TABLE very slow on large tables, the table that takes a long time has tons of dirty blocks in the cache. And normally, when we talk about a "slow" truncate, we're talking tens of  Truncate is fast, usually on the order of seconds or less. If it took 30 minutes, you probably had a case of some foreign keys referencing the table you were truncating. There may also be locking issues involved.

Ask TOM "Truncate Partition is very slow", Use the TRUNCATE TABLE statement to remove all rows from a table. Oracle Database Data Cartridge Developer's Guide for more information on domain If a regular or index-organized table contains LOB columns, then all LOB data and​  Hi, We are facing an issue with Informatica while truncating the table. We have truncated the table directly in the database itself which took less time , but when we do the same thing through informatica ( Truncate target table option) is taking too much time. Example: Table with records :13356699 Time taken to truncate in DATABASE Elapsed: 00:00

  • Also, please check:
  • What are the stats on your machine?
  • i have killed the query, by the time i killed it already deleted 600 thousand records, but since data was not important to me so i just copied the structure of old table to a new one and then dropped the old one.
  • if truncate is slow i am thinking of creating a new table with same structure and then dropping the old one, i think that will be quite fast. pls share ur views on this.
  • the problem I had was that a stale connection was stuck doing a commit to the table so it was frozen.