Change the function from STABLE to IMMUTABLE. My tests on 8.4.4 dropped the explain from about 0.14ms to 0.04 ms per call. Since it never hits the database and is really a true function (i.e.
For each input value x, there is one and only one possible f(x)), it really should be IMMUTABLE. This should allow the planner to evaluate it only once for each pair of (n,p) .
Wild guess: The ORDER BY price_discount is the problem. The database has to process all records before it can do any sort operation and spit out the requested 15 results.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.