Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

hi there, `spy_oms_order_item_state_history` and `spy_oms_transition_log` are the biggest tables in

Options
UKK0LRJ6A
UKK0LRJ6A Posts: 14 🧑🏻‍🚀 - Cadet
edited February 2021 in Slack General

hi there,

spy_oms_order_item_state_history and spy_oms_transition_log are the biggest tables in our database. Is it safe + is it ok to remove old entries from both tables?

e.g. with:

DELETE FROM
    spy_oms_transition_log
WHERE
    created_at < CURRENT_DATE - interval '90' day;

Comments

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 🧑🏻‍🚀 - Cadet
    edited February 2021
    Options

    Hey @UKK0LRJ6A
    I think OrderDetail page is using the state-history table to show the order items with status history, so if you delete them you won’t see order items, this can be fixed by changing the join type from inner to left in one of the query, I don’t remember it honestly. 🙂
    Transition logs are stored in DB just for debugging reason in OMS, so if you don’t have any issue with old orders feel free to remove them!

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 🧑🏻‍🚀 - Cadet
    Options

    Also please don’t delete the old orders without any track back, you can export them to an archive storage

  • UKK0LRJ6A
    UKK0LRJ6A Posts: 14 🧑🏻‍🚀 - Cadet
    Options

    thanks @UK9N7MP96! is there already a public extension to move old orders into a archive storage?

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 🧑🏻‍🚀 - Cadet
    edited February 2021
    Options

    You can just easily export a dump and extract it into a different DB (off production), nothing specials and it could also be a monthly script/job

  • UKK0LRJ6A
    UKK0LRJ6A Posts: 14 🧑🏻‍🚀 - Cadet
    Options

    thanks!