For an answer to your direct question:
How can one see when a query result was last cached in SEDE?
One can't. This information is simply not exposed to SEDE.
- Cached plans and queries are cleared out during every refresh operation, so its age will always be 7 days or less (unless that specific step in the process fails).
- If one is trying to defeat the cache (force their query to run again), see How can I avoid the Data Explorer cache?
For the reasoning behind your question:
It's useful to see if SEDE has refreshed.
There are much better and more direct ways to do this. rene used to use this query:
We recently added some views to Data Explorer in part to provide a lot more transparency into this process. With those views, a couple of ways you could check on us to be sure we actually performed the most recent weekend's refresh (along with exactly when it happened, how long each database took, and what data was included):
Details about each database from the most recent SEDE refreshDetails about each database from the most recent SEDE refresh
SELECT site = CONCAT(site_url,'|',long_name), database_name, initialized, made_available, processing_time FROM dbo.sede_databases ORDER BY processing_time DESC;
On any individual database, you can check to be sure that data from the most recent refresh bumps up against midnight UTC on Sunday (which actually has nothing to do with the new views, and could have been done in the past):
The 10 most recent questions on Stack Overflow
SELECT TOP (10) Id, Title, CreationDate FROM Posts WHERE PostTypeId = 1 ORDER BY Id DESC;
You could run that on any site, but there are some caveats:
- Not every site has enough activity that this information will be conclusive. Some sites go days without Posts, so I use our busiest site as the model.
- While we've attempted to fix the "jagged edge" problem - where the data included in SEDE depended on when a database was loaded - some straggling information can still get through. For example, if a post created at 23:59 is modified at 00:20, that modification might be captured if the source row in
Posts
is read later than 00:20. But the correspondingPostHistory
row will not be captured.