If I have a cte such as the below code. How many times does the table People get queried against? I was under the impression that it was only called 1 time and stored in memory but some of my queries I have been running seem to be running a lot longer than they should be. Which leads me to believe that it may be hitting the People Table 3 times.
with ctegeneric as (select person from people where person = 'dumb')Select * from ctegeneric UNION ALLSelect * from ctegeneric UNION ALLSelect * from ctegeneric