# OPTIMIZE TABLE table\_name WITH (only\_expunge\_deletes = true) seems like never ending

**URL:** <https://community.cratedb.com/t/optimize-table-table-name-with-only-expunge-deletes-true-seems-like-never-ending/2000>\
**Category:** CrateDB\
**Created:** [March 14, 2025, 2:10am UTC](https://community.cratedb.com/t/optimize-table-table-name-with-only-expunge-deletes-true-seems-like-never-ending/2000 "2025-03-14T02:10:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yusuf\_Cansiz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/yusuf_cansiz/32/1320_2.png) [@Yusuf\_Cansiz](https://community.cratedb.com/u/Yusuf_Cansiz)\
**Post date:** [March 14, 2025, 2:10am UTC](https://community.cratedb.com/t/optimize-table-table-name-with-only-expunge-deletes-true-seems-like-never-ending/2000/1 "2025-03-14T02:10:08Z")

</div>

Hello,

I have a table in cratedb which had almost 360 million records. I deleted 100 million records from the table but size of the table did not decreased. I started the query OPTIMIZE TABLE table\_name  
WITH (only\_expunge\_deletes = true) last night query did not finished and also the size of the table is still increasing very fast. It was 2.1 T in size yesterday after I deleted the documents and executed optimize it is 2.7 T right now. quite hard to understand why it is increasing constantly without writing the data. I also tried to kill optimize query since it is not deleting anything and increasing the size of the table. It is not killable also .

---

<div class="post-metadata">

**Author:** ![Yusuf\_Cansiz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/yusuf_cansiz/32/1320_2.png) [@Yusuf\_Cansiz](https://community.cratedb.com/u/Yusuf_Cansiz)\
**Post date:** [March 14, 2025, 2:39am UTC](https://community.cratedb.com/t/optimize-table-table-name-with-only-expunge-deletes-true-seems-like-never-ending/2000/2 "2025-03-14T02:39:09Z")

</div>

To be more precise this is the information of the table segments table right now has:

SELECT  
SUM(deleted\_docs) AS total\_deleted\_docs  
FROM  
sys.segments  
WHERE  
table\_name = ‘table\_name’ limit 100; → this returns 229234152

select count(\*) from sys.segments where table\_name = ‘table\_name’ limit 100; → this returns 1131
