summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-10-24 14:33:20 +0200
committerYorhel <git@yorhel.nl>2015-10-24 14:34:49 +0200
commitbbe989de364ddc654bfc6385e22f1eaff23faad1 (patch)
tree53492ca720c207bc50472119e9e29ac566634794 /lib
parent173ac8de5d96957dcc93fae5e36f6df2f9ce7118 (diff)
SQL: Throwing around some indices
These indices provide a significant speed-up of /v+ and /u+ pages, and improve some other stuff as well.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/ULists.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm
index 23bde7cf..55ee9e37 100644
--- a/lib/VNDB/DB/ULists.pm
+++ b/lib/VNDB/DB/ULists.pm
@@ -238,11 +238,11 @@ sub dbVoteStats {
my $u = $self->authInfo->{id};
my $r = [ map [0,0], 0..9 ];
$r->[$_->{idx}] = [ $_->{votes}, $_->{total} ] for (@{$self->dbAll(q|
- SELECT (vote::numeric/10)::int-1 AS idx, COUNT(vote) as votes, SUM(vote) AS total
+ SELECT (vote::float/10)::int-1 AS idx, COUNT(vote) as votes, SUM(vote) AS total
FROM votes
!s
!W
- GROUP BY (vote::numeric/10)::int|,
+ GROUP BY (vote::float/10)::int|,
$ign ? 'JOIN users ON id = uid AND (NOT ign_votes'.($u?sprintf(' OR id = %d',$u):'').')' : '',
$col ? { '!s = ?' => [ $col, $id ] } : {},
)});