On 3/5/2016 12:20 PM, Paul Sanderson wrote: > If it computes many things and doesn't return many rows then I don't > really care. I only want to know how many rows a query will return > before I execute it in full.
That would require a crystal ball or a time machine. Absent those, it's impossible to know how many rows a query will produce until it actually runs and produces them. Again, you can wrap an arbitrary query like this: select count(*) from ( select whatever ... ); This query always returns exactly one row and one column, with the value being the number of rows that the inner query would have returned. Is this not what you want? Of course, it would take approximately as much time to run this new query as it would the original query. -- Igor Tandetnik