Dynamic Sampling and Partitioning

A question on OTN asked about the interaction between dynamic sampling and partitioning, what difference does partitioning make to level 2 dynamic sampling?

To recap on dynamic sampling levels, level 2 says that dynamic sampling should be applied to all unanalysed tables with the number of sampled blocks being twice the default (32).

Asif Momen and Randolf Geist have two interesting studies showing how different variations on table, partition and subpartition statistics affect whether dynamic sampling is used at all – i.e. partitioning introduces a qualification/variation to that definition above of all unanalysed tables and affects whether dynamic sampling is eligible.

The other element to the question is, the above aside, once we’re in a situation where dynamic sampling is valid and eligible, is there any effect of partitioning on dynamic sampling? I.e. does dynamic sampling do anything special for a partitioned table?

The question is answered by looking at a 10046 trace which reveals how dynamic sampling does it’s stuff.

Taking, if he’ll excuse me, the table from Randolf’s post and the first query:

The point being that the queries are the same for both the partitioned and unpartitioned table – there’s no special treatment – although the access plans for these recursive queries are going to be different due to the partitioning.

As an aside, what prevents us from entering an infinite loop of dynamic sampling of the dynamic sampling queries?