Break up expensive queries, match index to quals
authorMike Rylander <mrylander@gmail.com>
Fri, 19 Jul 2013 16:35:31 +0000 (12:35 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 25 Jul 2013 19:51:16 +0000 (15:51 -0400)
commita96e239fcd9c368f575ad972708c7cec46e18d81
tree477301f13c99fd8b88c470ed5576bc8a82fcf38a
parent6b38b2b811dae7d0be365992851200058b67c16e
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>
Open-ILS/src/sql/Pg/030.schema.metabib.sql
Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql