On Wed, 28 Apr 2004 08:23:35 -0400, Rod Taylor <pg@rbt.ca> wrote:
>The below plpgsql forces the kind of algorithm we wish the planner could
>choose. It should be fairly quick irregardless of dataset.
That reminds me of hash aggregation.  So here's another idea for Vitaly:
    SELECT book_id
      FROM ...
     WHERE ...
     GROUP BY book_id
     LIMIT ...
Servus
 Manfred