owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.35k stars 227 forks source link

Deprecate table `country_latest_data` #3742

Open Marigold opened 4 days ago

Marigold commented 4 days ago

One of our largest tables is country_latest_data. It's apparently used for country pages, but no one knows why. The table is just data_values in disguise. Apparently it is updated by something, but I wonder whether we even use for anything at all.

+----------+---------------------------+-----------+
| Database | Table                     | Size (MB) |
+----------+---------------------------+-----------+
| owid     | variables                 |    614.39 |
| owid     | country_latest_data       |    339.13 |
| owid     | chart_revisions           |    137.72 |
| owid     | posts                     |    118.61 |
| owid     | suggested_chart_revisions |     87.66 |

Some values for 2024 (this doesn't necessarily mean they were created in 2024!)

mysql> select * from country_latest_data where year = 2024 limit 10;
+--------------+-------------+------+---------+
| country_code | variable_id | year | value   |
+--------------+-------------+------+---------+
| BDI          |      521018 | 2024 | 340868  |
| COM          |      521018 | 2024 | 37730   |
| DJI          |      521018 | 2024 | 53887   |
| ERI          |      521018 | 2024 | 155581  |
| ETH          |      521018 | 2024 | 4148801 |
| KEN          |      521018 | 2024 | 1662357 |
| MDG          |      521018 | 2024 | 1078654 |
| MWI          |      521018 | 2024 | 537527  |
| MUS          |      521018 | 2024 | 180185  |
| MYT          |      521018 | 2024 | 10603   |
+--------------+-------------+------+---------+
10 rows in set (2.72 sec)