The short and not so sweet answer is this- Don't buy one with out a CPO warranty or extended service contract from a reputable underwriter. They complicated machines, as I'm sure you know, and can be very expensive to repair for even seemingly small issues. I don't believe Q7s to be disproportionately less reliable than their competitors, but they do have more features and functions than the "average" car, so there are more points of failure. Set your expectations accordingly, and you will enjoy the vehicle. Obviously if you are mechanically inclined and typically work on your own cars, you could own Q7 without a warranty, but you should expect to work on it at multiple times in a 5 year period.
Depending on what part of the world you are in, there may be different CPO or ESC options available and my experience is from the US market on Q7s and related warranty offerings, so what was available and made sense for me, may not make sense for you.
In general, if you want 4-5 years of coverage at typical mileage per year, a 2012 or 2013 that has typical miles for that age would be the way to go if looking at CPO (in the US 6 total years from first owner registration date and 100,000 total odometer miles). If looking at older model years (as I was last summer), you want to find as low a mileage vehicle as you can reasonably afford so that if an extended service contract is available, it will be much more affordable. For example, I was looking at '08 and '09 Q7s and when getting ESC quotes from the dealer or from good 3rd party firms, a comparable Platinum/limited exclusion 4yr/48,000 mile ESC was ~$3000 if the vehicle had under 35,000 miles, but that more than doubled ($7000-$8000) if the mileage was at the 65,000 mark.
In terms of purchase price + warranty cost, it may end up coming out equal in the low miles (higher purchase price), low warranty cost vs. the converse of this for a high mile vehicle. In my case I paid more for a low mileage '08, in part because the ESC was going to be cheaper to buy, but there were other compelling reasons with my Q7 as well, such as it being 1 owner, full service history at the selling dealer, all maintenance properly done and up to date, and was almost fully optioned for a 3.6.
Good luck in your hunt.