concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
105 stars 66 forks source link

Bulk-Removal of Products/Orders older than date XXXX #851

Open cahueya opened 7 months ago

cahueya commented 7 months ago

If a shop runs over a period of time, the database grows with products and orders which can even lead to the reports pages to stalling sometimes.

Manual deletion of old products is a cumbersome clicki-clicki process and removing stuff from the database leaves a lot a of attribute values without their necessary counterparts.

What do you think about a function to remove products and orders by daterange or ID?

I mean - If a product is out of stock for 3 years so all the bookkeeping is done, it should be able to remove it safely together with all the connected data that piles up so much in the database. What do you think?

Mesuva commented 7 months ago

I think it's a good idea, but I think before that I'd be interested to see why the reports pages is stalling.

That might be some missing indexes or something else inefficient, that needs to be replaced with better queries.

Database wise, we shouldn't have to think about purging data to make reports work well, they should be fine with tens/hundreds of thousands of records.

cahueya commented 7 months ago

Thats a good input. So the example shop I'm talking has about 20000 Orders in place from around 900 products, producing around 800 reports pages in /store/reports/products and the page stalls half of time with HTTP500 when opening it. So you think reindexing would solve the issue?

Mesuva commented 7 months ago

So it's the actual list of products that is stalling? Or when you go a step further and view a particular product?

cahueya commented 7 months ago

The list on first page load, so the first query without any options stalls already. But also when filtering by name, the stalls are happening.