Problem with database?

Hello,

My system versions:
Home Assistant 2023.4.5
Supervisor 2023.04.0
Operating System 10.0

I use MariaDB 2.5.2 database.

Sometimes, I use SQLite Web addon to watch which entities store the higher number of states, so I can optimize dababase size. To do that, I use the query:

SELECT entity_id, COUNT(*) as count FROM "states" 

Or something more specific. The problem is that lately (last HA version, I think), the result I get is always:

entity_id	count
NULL	762578

I’ve checked the content of states table and most of the fields have NULL value:


state_id	domain	entity_id	state	attributes	event_id	last_changed	last_updated	created	old_state_id	attributes_id	origin_idx	context_id	context_user_id	context_parent_id	last_updated_ts	last_changed_ts	context_id_bin	context_user_id_bin	context_parent_id_bin	metadata_id
31551633	NULL	NULL		35.1	NULL		NULL		NULL		NULL				NULL	NULL	2241397	0	NULL	NULL	NULL	1680660720.320469	NULL	\x87O/j\xc0\xba\xf3\xfdľ䜏	NULL	NULL	525
...

I don’t know if this is normal or there’s any problem with the database.

Apart from that, I haven’t seen any strange behaviour in HA.

Thanks!

It is normal.

1 Like

I’ve just seen how to do it new in this post: All entity_id NULL - #27 by jumacabo