Physics of heating a swimming pool This is motivated by a practical problem, but it's the pure physics that really puzzles me.
My pool is heated via a heat exchanger.  Water from the boiler enters the heat exchanger through (let's call it) Pipe A and leaves through Pipe B.  Water from the pool enters the heat exchanger, comes into contact with these pipes, and returns to the pool.  Pipe B is consistently cooler to the touch than Pipe A; it seems clear that this temperature difference measures the rate at which heat is being transferred to the pool water.
I can turn a valve that controls the rate at which pool water enters (and leaves) the heat exchanger.  My instinct is to leave this valve maximally open.  My pool guy insists that this is a mistake; instead there is some optimum rate, less than the available maximum, at which water should be sent through the heat exchanger.  His argument is that if the water passes through the exchanger too fast, it doesn't have time to pick up much heat.  My counter-argument is that yes, if you increase the flow rate, then any given volume of water will pick up less heat per minute --- but you're heating a greater volume per minute.
Moreover, my intuition tells me that these effects should exactly cancel --- the rate of heat transfer between the PipeA/PipeB circuit and the pool water should depend only on the current temperature difference between Pipe A and the pool water, and therefore (at least above a certain minimum) the rate of pool water flow should be irrelevant.  My pool guy's experience tells him otherwise.  
Is he right, and if so, exactly what determines the optimal rate of pool water flow?
Edited to  add: To clarify what I'm optimizing:  I want to minimize the time it takes to get the pool water from some initial temperature to some (higher) desired temperature.
Edited to add:  The water coming from the boiler is always kept at a fixed 180 degrees, and returns at a lower temperature.  Therefore the boiler works harder when more heat is being transferred to the pool water (more heat transfer implies colder return to the boiler implies more work for the boiler to reheat that water).  So answers that assume a fixed amount of work by the boiler seem to me to be at best incomplete.   
(And just to clarify even further:  There are two thermostats.  One turns off the boiler when the water in Pipe A hits 180 degrees; the other turns off the boiler when the pool water reaches the desired temperature.)
 A: I will assume your heat exchanger uses the common counter flow principle - that is, the direction of flow of the "cold" water opposes that of the "hot" water, so the hottest water in the heating loop (entering the heat exchanger) is in touch with the hottest water of the pool loop (just before exiting the heat exchanger).
The heat flow across the exchanger is proportional to the temperature difference. Since the "input temperature" is fixed at 180 F, the only variable is the temperature of the "sink" - the pool water. The colder the pool water, the greater the heat flow.
At the input of the heat exchanger, the temperature is the temperature of the pool; at the exit, it will be somewhat warmer. The slower the water flows, the more heat it will pick up, and the hotter the water that re-enters the pool. However, the hotter the pool water in the exchanger, the smaller the thermal gradient, and therefore the smaller the heat flux into the pool water.
The water will heat most rapidly if the pool water runs quickly - this keeps the temperature difference greatest.
There is just one caveat: the power of the pump moving the water. If the pump is working harder to move water through a constricted valve, it would generate a little bit more power; if the water flow is set up so heat from the pump is dumped to the water, you will get a small amount of additional heating; but I don't believe that would ever offset the benefit of the faster gradient.
One other consideration: what happens to the surface of your pool. This relates to the way the output of your heat exchanges returns to the pool. If you have a jet that dumps deep inside the pool, there will be little disturbance at the surface; if it's aimed at the surface, you will cause some "stirring". As you may know, the greatest heat loss from a pool happens through evaporation - so if there is anything in your setup that increases evaporation as a function of flow rate through the heat exchanger, that will affect the total heating time.
If it were my pool, I would probably rig up a thermocouple and a data logger, and look at the evolution of temperature. Turn the flow rate up and down every two hours or so, and see if you can observe a change in heating rate on the temperature trace.
I am sorry - according to the laws of physics, your pool guy is wrong. Open that valve, and let the water flow!
A: *

*Let's make a simplified ideal model of the situation: ignore heat losses to environment (evaporation, surface conduction) and gains from other sources (pumps running hot). Also, assume that the flow rate in the boiler pipe is the same, independent of the temperature in pipe B (as long as the boiler is running).

*Consider the problem from the other side: what is the most efficient way to extract energy from the boiler. As the boiler pipes run at const flow rate (by assumption above), the power extracted is proportional to the temperature difference between pipes A and B. In particular, the rate of heat input from the boiler (= heat production) is not constant.

*Hence, the most efficient way to heat the pool is that which, at any time, minimises the temperature in pipe B. Now, consider the two extremes of a very low or very high flow rate of pool water through the heat exchanger.

*In the limit of a very low flow rate, much lower than that of the boiler water, the pool water will get fully heated to 180 degrees, but the energy exchanged is lower than that available, i.e. the boiler water will not cool to the pool input water.

*In the opposite limit of a very high flow rate, the boiler water may be cooled down all the way to the pool temperature, obtaining maximum efficiency. However, this depends on the efficiency of the heat exchanger. It would seem, though that this is maximal at highest flow rate (since then the temperature difference between boiler and pool side is highest).

*This all suggests that the pool guy was wrong, but I'd rather trust his experience. However, the proof of the pudding is in the eating: just try it out man.
A: Floris's answer seems to me to be exactly right, but a friend
whose paranoid browser settings don't allow him to post here
suggested one additional wrinkle, which I'll post as an answer
since I'm not sure how else to share it.
My first thought had been that the rate of heat transfer was
determined by the temperature of the pool water and the 
(fixed) temperature of the water in Pipe A, so that the rate
of flow was irrelevant.  Floris pointed out what I had missed:
As the pool water passes through the heat exchanger, its 
temperature rises and the rate of heat transfer therefore
drops.  So we want to minimize that temperature increase, 
which means we want to maximize the flow rate.  
Again, that seems to me to be basically right, and to 
contain all of the physics I wanted to understand.  But
as a practical matter, here is the additional wrinkle,
quoted from my friend's email:


Here's where real-world considerations modify things.  We took
as a given the 180 degree input water.  That's not exactly the case.
First of all, the furnace thermostat will let the temperature drop
before kicking in to bring the water back to 180.  Secondly, there
are two heat exchangers involved.  One is the one we're considering;
the other is the one within the furnace that transfers the 180
water's heat within the furnace to the pool loop.  I could conceive
of a circumstance where the return water is so cool that the
exchanger within the furnace ends up surrounded by water that's well
below the 180, causing the pool feed to drop in temperature.  Within
the furnace itself, you're relying on natural convection to keep the
in-furnace heat exchanger warm.  The answer may well be the same,
but it's more complicated.


.....


My household hot water comes from a heat exchanger in the
furnace (rather than an intermediate tank as in your setup).
My supply of hot water should be infinite; the furnace has
BTUs enough to heat the whole house - hot water doesn't
need a fraction of its capability.

Still, I can run out of hot water by opening the tap to
max and letting it flow for a while.  If I slow the
flow, it will start getting hot again.  It's the
internal convection in the furnace that limits the
rate the heat exchanger can usefully heat water.

All of this can happen despite the restricted-flow valve
installed in-line to limit this very problem.  Similarly,
there may be a limiting return-temperature that will
cause this same problem with the pool loop.


And while I'm at it, one more thing that might be relevant to the real-world problem even if irrelevant to the interesting physics:  It seems possible that a higher flow rate will reduce the life of the heat exchanger, and that if one reformulated the optimization problem to account for this, the answer might change.
A: If we assume an ideal system, with no heat loss in the plumbing, then the time for the pool to warm from dead cold to equilibrium will be independent of the flow rate in the pool loop of the heat exchanger.
The boiler has a fixed rate of heat energy production.  All that energy will be transferred to the transfer fluid;  if it isn't, the boiler will explode, or go into overheat shut-down.
The transfer fluid will pick up heat energy from the boiler; depending on the flow rate in this loop, the transfer fluid will undergo a certain increase in temperature.
The transfer fluid will enter the pool heat exchanger at a certain temperature, and transfer the heat that it picked up to the pool fluid.  If it doesn't, something nasty will happen to the transfer fluid.
Suppose you have the system chugging along at some particular pool fluid flow rate.  You decide to increase the rate of flow of the pool water.  This removes extra heat from the transfer fluid, lowering its temperature as it returns to the boiler.  But this, in turn, reduces the temperature of that transfer fluid coming back from the boiler, so it will transfer less heat to each unit of pool fluid.
Short version:  The boiler produces heat at a certain rate.  It delivers the energy to the transfer loop, which transfers it to the pool fluid. If these aren't equal, then either you've discovered a new source of free energy, or something will blow up after a while...
