# Gladys database error

**URL:** <https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905>\
**Category:** Configuration\
**Created:** [January 29, 2023, 10:08am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905 "2023-01-29T10:08:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 29, 2023, 10:08am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/1 "2023-01-29T10:08:41Z")

</div>

Bad news for me this morning. Gladys is no longer functional. 😥  
I don’t know what happened last night but my database has an error so no more Gladys

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/3/3e0ffb8217ad1ce76065202fc3ff1a9d94637ee0.png)

Well, now I just have to re-import a Gladys Plus backup!!!

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 29, 2023, 3:54pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/2 "2023-01-29T15:54:36Z")

</div>

Well, actually I need to reinstall everything 😥 😥  
After restarting it, the Pi is no longer accessible on my network. I don’t really know what happened to

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [January 29, 2023, 4:12pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/3 "2023-01-29T16:12:55Z")

</div>

SSD or SD card? It smells like data corruption…

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 29, 2023, 4:14pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/4 "2023-01-29T16:14:05Z")

</div>

It’s an SSD.

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 29, 2023, 7:51pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/5 "2023-01-29T19:51:15Z")

</div>

Maybe there was a power outage during the night?

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 29, 2023, 8:10pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/6 "2023-01-29T20:10:37Z")

</div>

Maybe I don’t know [EDIT] no, not possible — my Pi is on a UPS, in any case even on a PC my hard drive doesn’t respond!  
And my Pi won’t boot from the SSD now! Really strange

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [January 30, 2023, 7:02am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/7 "2023-01-30T07:02:01Z")

</div>

Your database is corrupted, these things can happen.

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 30, 2023, 7:11am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/8 "2023-01-30T07:11:10Z")

</div>

I’m afraid I have more problems than that.  
I can no longer read

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 30, 2023, 7:52am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/9 "2023-01-30T07:52:37Z")

</div>

> [@\_Will\_71](#):
>
> I feel like Gladys is pushing me to replace my Raspberry Pi. 🤣😂

There we go, another mini-PC to plan for ^^

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 30, 2023, 7:55am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/10 "2023-01-30T07:55:31Z")

</div>

I think this is a good opportunity for me to look into another solution, a mini PC or something else…

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 30, 2023, 11:28pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/11 "2023-01-30T23:28:03Z")

</div>

Okay, I got the Pi running again with another SSD.  
We’ll see about replacing my Pi later!

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [January 30, 2023, 11:41pm UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/12 "2023-01-30T23:41:19Z")

</div>

@pierre-gilles, so I looked at the database which after 10 months is about 12Go, and there are a lot of things that are not deleted over time

I set the history setting to 3 months but in the database in the table _t\_device\_feature\_state\_aggregate_, for example, the data dates from the beginning of my use of Gladys until now.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/e/e53e9a21e80a9f3f47025e859a17d8c33473e137.png)

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/2/2bf164f4be0ed1ba479f2b58e4afe7680c89e963.png)

And so I end up with 13,000,000 rows in the db which for the most part are no longer useful.  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/2/27b21d56c171c70c837c071d350a7745f645479c.png)

Isn’t this table affected by the history option?  
Same for the _t\_location_ and _t\_message_ tables? Do we really need to keep all this data in the db longer than what’s selected in the setting?

Or do we need to do the cleanup with the function below?

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/5/58d73e56a0b3e6102c8cc40137a320e88e4dbf50.png)

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 31, 2023, 2:05am UTC](https://community.gladysassistant.com/t/gladys-erreur-base-de-donnee/7905/13 "2023-01-31T02:05:09Z")

</div>

> [@\_Will\_71](#):
>
> I set the history setting to 3 months but in the database, in the table _t\_device\_feature\_state\_aggregate_, for example, the data date back to when I started using Gladys.

Indeed, currently the aggregated table is not affected by this setting.

The idea would be to have several parameters to be able to quickly clear the «&nbsp;live&nbsp;» data (which are extremely heavy), and then other parameters for the «&nbsp;per month/per day/per hour&nbsp;» data.

In the meantime, if you want to do the cleanup yourself you can run a quick DELETE FROM.
