Skip to content
Snippets Groups Projects
Commit 624035b5 authored by Robert Anderson's avatar Robert Anderson
Browse files

Deferred usage calculations to the database

Indexed PeriodKey column
parent c5ff9032
No related branches found
No related tags found
No related merge requests found
...@@ -244,6 +244,7 @@ CREATE TABLE @PREFIX@accounting ( ...@@ -244,6 +244,7 @@ CREATE TABLE @PREFIX@accounting (
PeriodKey VARCHAR(255) PeriodKey VARCHAR(255)
) @CREATE_TABLE_SUFFIX@; ) @CREATE_TABLE_SUFFIX@;
CREATE INDEX @PREFIX@accounting_idx1 ON @PREFIX@accounting (Username); CREATE INDEX @PREFIX@accounting_idx1 ON @PREFIX@accounting (Username);
CREATE INDEX @PREFIX@accounting_idx2 ON @PREFIX@accounting (PeriodKey);
......
...@@ -193,11 +193,11 @@ sub init ...@@ -193,11 +193,11 @@ sub init
$config->{'accounting_usage_query'} = ' $config->{'accounting_usage_query'} = '
SELECT SELECT
AcctInputOctets, SUM(AcctInputOctets) AS AcctInputOctets,
AcctOutputOctets, SUM(AcctOutputOctets) AS AcctOutputOctets,
AcctInputGigawords, SUM(AcctInputGigawords) AS AcctInputGigawords,
AcctOutputGigawords, SUM(AcctOutputGigawords) AS AcctOutputGigawords,
AcctSessionTime SUM(AcctSessionTime) AS AcctSessionTime
FROM FROM
@TP@accounting @TP@accounting
WHERE WHERE
......
...@@ -346,11 +346,11 @@ EOT ...@@ -346,11 +346,11 @@ EOT
accounting_usage_query=<<EOT accounting_usage_query=<<EOT
SELECT SELECT
AcctInputOctets, SUM(AcctInputOctets) AS AcctInputOctets,
AcctOutputOctets, SUM(AcctOutputOctets) AS AcctOutputOctets,
AcctInputGigawords, SUM(AcctInputGigawords) AS AcctInputGigawords,
AcctOutputGigawords, SUM(AcctOutputGigawords) AS AcctOutputGigawords,
AcctSessionTime SUM(AcctSessionTime) AS AcctSessionTime
FROM FROM
@TP@accounting @TP@accounting
WHERE WHERE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment