Break up expensive queries, match index to quals
authorMike Rylander <mrylander@gmail.com>
Fri, 19 Jul 2013 16:35:31 +0000 (12:35 -0400)
committerKathy Lussier <klussier@masslnc.org>
Thu, 25 Jul 2013 20:51:14 +0000 (16:51 -0400)
commit6cb28343a358d4163307b4b8f5c4e509e28298bb
tree477301f13c99fd8b88c470ed5576bc8a82fcf38a
parentc0b93eabcc8248f647694599c9676887bdf791d0
Break up expensive queries, match index to quals

First, we order browse queries over MBE by (sort_value, value) so we
want to match the unique index to that.

We're only going to use the first few rows of the cursors we build from
the back/forward MBE paging queries, and the embedded GROUP BY defeats
the planners desire to use an index for ordering the rows. So, instead,
we use a simpler core query and gather aggregate data as a secondary,
index-capable query for each MBE row.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/sql/Pg/030.schema.metabib.sql
Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql