From 943aa38564c7322fcc3534625cf05e1ba3f09d53 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Mon, 9 Nov 2009 15:44:14 +0100 Subject: [PATCH] overdue performance restored (INCOMPLETE FIX) The performances of this script felt back. Investigating, it's due to the extended attribute filtering improvement when there are ext attributes, the script does a: SELECT borrowernumber AS bn, b.code, attribute AS val, category AS avcategory, lib AS avdescription FROM borrower_attributes b JOIN borrower_attribute_types bt ON (b.code = bt.code) LEFT JOIN authorised_values a ON (a.category = bt.authorised_value_category AND a.authorised_value = b.attribute) that returns a LOT of datas when you have 10 000 patrons and 5 attributes. That results in the page needing something like 10 seconds to be loaded. There are some other caveats. I've commented a few lines that remove the extended attr option. The best solution would be to fix it better, but I can't find how to do that now. (note : i also have commented some lines that are unused) --- circ/overdue.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/circ/overdue.pl b/circ/overdue.pl index b1b1be4165..4257fdf423 100755 --- a/circ/overdue.pl +++ b/circ/overdue.pl @@ -100,7 +100,7 @@ for my $attrcode (grep { /^patron_attr_filter_/ } $input->param) { my $have_pattr_filter_data = keys(%cgi_attrcode_to_attrvalues) > 0; my @patron_attr_filter_loop; # array of [ domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category ] -my @patron_attr_order_loop; # array of { label => $patron_attr_label, value => $patron_attr_order } +#my @patron_attr_order_loop; # array of { label => $patron_attr_label, value => $patron_attr_order } my @sort_roots = qw(borrower title barcode date_due); push @sort_roots, map {$_ . " desc"} @sort_roots; @@ -144,13 +144,13 @@ while (my $row = $sth->fetchrow_hashref) { }; } } continue { ++$ordinal } -for (@patron_attr_order_loop) { $_->{selected} = 1 if $order eq $_->{value} } +#for (@patron_attr_order_loop) { $_->{selected} = 1 if $order eq $_->{value} } $template->param(ORDER_LOOP => \@order_loop); my %borrowernumber_to_attributes; # hash of { borrowernumber => { attrcode => [ [val,display], [val,display], ... ] } } # i.e. val differs from display when attr is an authorised value -if (@patron_attr_filter_loop) { +if (0 && @patron_attr_filter_loop) { # MAYBE FIXME: currently, *all* borrower_attributes are loaded into %borrowernumber_to_attributes # then filtered and honed down to match the patron attribute filters. If this is # too resource intensive, MySQL can be used to do the filtering, i.e. rewire the @@ -200,12 +200,11 @@ if (@patron_attr_filter_loop) { $template->param( - patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ], branchloop => GetBranchesLoop($branchfilter, $onlymine), branchfilter => $branchfilter, borcatloop=> \@borcatloop, itemtypeloop => \@itemtypeloop, - patron_attr_filter_loop => \@patron_attr_filter_loop, +# patron_attr_filter_loop => \@patron_attr_filter_loop, borname => $bornamefilter, order => $order, showall => $showall); -- 2.39.5