Comment 2 for bug 587028

Revision history for this message
Mike Rylander (mrylander) wrote : Re: [Bug 587028] Re: Inefficient asset.copy barcode index slows down circ transactions in pg 8.3

On Tue, Jun 1, 2010 at 12:35 PM, Dan Scott <email address hidden> wrote:
> This looks good to me. I can confirm that the change made a significant
> difference to the results of EXPLAIN ANALYZE on our 8.3 system (from
> 1419 ms to 0.060 ms) for the deleted = 'f' case.
>

[snip]

> In order to use the index and save hundreds of ms off of those queries, the index should probably be changed to something like:
>
> CREATE UNIQUE INDEX copy_barcode_key ON asset.copy (barcode) WHERE deleted IS FALSE OR deleted = 'f';
>

cstore will only ever generate a query with the = operator for boolean
columns. All that's needed in the WHERE clause for the index is
"WHERE deleted = 'f'". Dan, do you want to do the upgrade script, or
shall I?

--
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone: 1-877-OPEN-ILS (673-6457)
 | email: <email address hidden>
 | web: http://www.esilibrary.com