<p>Try manually forcing garbage collection after you've trashed all your entries in the CP. Using the cli, run <code>./craft gc</code></p>

CC BY-SA 4.0
2020-10-24T14:34:33.697Z
2020-10-24T14:34:33.697Z
Wallace
<p>&quot;Personally I'd just use the 'select all' checkbox at the top of entries and delete them all at once.&quot;</p>
<p>That's what I've been doing - deleting all entries in the system. I've always thought that by deleting entries in the system it would clean the database.</p>
<p>But when looking in the database there is so much information that is still saved even though everything is deleted in the system.</p>
<p>Now I have a database that is over 300mb, with old content in Matrix columns, craft_elements and more.</p>
<p>UPDATE:</p>
<p>This is what I've done so far:</p>
<ol>
<li>In craft_elements I deleted all rows with type LIKE &quot;Entry&quot;.</li>
<li>Emptied all my matrix tables.</li>
</ol>
<p>Because I cleaned all entries from the craft_elements I also removed the single section entries. By saving those sections again the entries where created.</p>
<p>The database have gone from 318mb to 16mb. The system seems to be working great now and I hope it will be in the future :)</p>

CC BY-SA 4.0
2020-10-23T09:58:10.977Z
2020-10-23T10:23:18.120Z
2020-10-23T10:23:18.120Z
Oscar
<p>I'd avoid doing anything in the database directly. Personally I'd just use the 'select all' checkbox at the top of entries and delete them all at once.</p>
<p>You could also consider starting with a blank database and trying to apply a project config file to replicate the structure without the content. I haven't tried that yet though.</p>

CC BY-SA 4.0
2020-10-23T09:49:04.950Z
2020-10-23T09:49:04.950Z
darylknight
<p>I've create 20+ websites in Craft and each time I've always started with the use of another site's database. (time saving to not have to create all fields, sections and more)</p>
<p>On my latest site's database I see I have content from a very old website, build 2016.</p>
<p>What is the best way to delete old content from the database in a safe way?</p>
<p>craft_elements = 52mb
craft_content = 34mb
craft_element_sites = 34mb</p>

<database>
How to delete old content in a Craft CMS database?
# How to delete old content in a Craft CMS database?

(Asked by: username_0 on 2020-10-23)

I've create 20+ websites in Craft and each time I've always started with the use of another site's database. (time saving to not have to create all fields, sections and more)

On my latest site's database I see I have content from a very old website, build 2016.

What is the best way to delete old content from the database in a safe way?

craft\_elements = 52mb
craft\_content = 34mb
craft\_element\_sites = 34mb

**Tags:** database


---

## 3 answers

### Answer by username_1 on 2020-10-24. Score: 1

Try manually forcing garbage collection after you've trashed all your entries in the CP. Using the cli, run `./craft gc`


---

### Answer by username_0 on 2020-10-23. Score: 1

"Personally I'd just use the 'select all' checkbox at the top of entries and delete them all at once."

That's what I've been doing - deleting all entries in the system. I've always thought that by deleting entries in the system it would clean the database.

But when looking in the database there is so much information that is still saved even though everything is deleted in the system.

Now I have a database that is over 300mb, with old content in Matrix columns, craft\_elements and more.

UPDATE:

This is what I've done so far:

1. In craft\_elements I deleted all rows with type LIKE "Entry".
2. Emptied all my matrix tables.

Because I cleaned all entries from the craft\_elements I also removed the single section entries. By saving those sections again the entries where created.

The database have gone from 318mb to 16mb. The system seems to be working great now and I hope it will be in the future :)


---

### Answer by username_2 on 2020-10-23. Score: 0

I'd avoid doing anything in the database directly. Personally I'd just use the 'select all' checkbox at the top of entries and delete them all at once.

You could also consider starting with a blank database and trying to apply a project config file to replicate the structure without the content. I haven't tried that yet though.


---

