Clear and complete info how to delete ALL data for a sensor

Can someone please give complete info in which tables is HA storing data it puts into the history for a sensor. I’ve wasted half a day trying to delete it and despite clearing states, statistics, statistics_short_term, runnig recorder.purge_entities and restarting all I’ve managed to do it to have the sensor disappear from (Dev)statistics page altogether (it had no option to edit stats data so I couldn’t just do that - its a mystery to me why some sensors have this option and others don’t) and show the state as unavailable.

But when it is clicked a chart with bad data still shows up.

Where is it getting this data from? Which table? Does anyone know?