Posts Missing in Dashboard after update

Your SQL query is correct, but… There is no proper WHERE part in it:

SELECT count(*) FROM `wp_posts` WHERE 1

So it will count all rows in that table. And that table contains posts, but also much more…

First of all, this table contains column post_status. Some posts may be trashed, for example and you will still count them.

But there is even bigger problem with this count. You ignore the type of posts (column post_type). And WordPress stores many objects as “posts”. For example all attachments from Media Library are stored in wp_posts table. Items of menus are also posts. And posts have revisions – they also are stored as posts.

So to check what posts are there in DB, you’ll have to use query like:

SELECT * FROM wp_posts

and check all of them one by one. This will show you all posts in this table and you’ll be able to check what posts are missing.

And if some posts are not in that table any more, then it will be impossible to restore them (unless you have any backups).