1

I would like to estimate the number of rows a query will return without executing it.

I was thinking about statistics and execution plan. Did anyone do something like this?

Corovei Andrei
  • 1,646
  • 6
  • 28
  • 42
  • possible duplicate of [how to know how many rows will be affected before running a query in microsoft sql server 2008](http://stackoverflow.com/questions/12437227/how-to-know-how-many-rows-will-be-affected-before-running-a-query-in-microsoft-s) – Pred Sep 29 '14 at 08:11
  • 1
    no, I know about rowcount. I don't want the query to run at all. I want to use existing statistics. – Corovei Andrei Sep 29 '14 at 08:55
  • That isn't possible. How would you know what the execution is going to be for a query that hasn't run? What could you possibly hope to gain by this? – Sean Lange Sep 29 '14 at 18:31
  • the new Sql 2019's `APPROX_COUNT_DISTINCT()` may do the trick. try it out and tell me if it works as u want it to work. – AgentFire May 08 '19 at 23:41

0 Answers0