Compare the PVs of today with those of yesterday based on NGINX access logs.
Keyword
Comparison
correlation function
round,compare,count
Use the count function to calculate the number of page views (PVs) and then use the compare function to obtain the day-to-day comparison for PVs of today and yesterday.
The results are displayed in a single value chart. In this example, the number of PVs of today is 20.381Mil, with a change of -2% compared with that of yesterday.
SQL
* |
select
diff [1] as today,
round((diff [3] -1.0) * 100, 2) as growth
FROM
(
SELECT
compare(pv, 86400) as diff
FROM
(
SELECT
COUNT(1) as pv
FROM
log
)
)