YOURLS_NOSTATS + shunt_update_clicks still allows full-table SELECT from yourls_log (slow query) #3985
Replies: 1 comment 3 replies
-
|
Indeed, valid point. This typically something that should not need a plugin to fix. The idea behing This said I don't see where we're querying |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
Even with stats disabled, I’m seeing a very expensive read from yourls_log in MySQL slow logs. The query appears to fetch all rows from the log table, causing multi-second stalls under load.
From mysqldumpslow:
I would like to completely disable any queries to yourls_log (reads and writes) when stats are turned off.
Count: 1 Time=19.20s (19s) Lock=0.00s (0s) Rows_sent=4383285.0 (4383285), Rows_examined=4383285.0 (4383285), Rows_affected=19.2 (19), root[root]@localhost SELECT /*!N SQL_NO_CACHE */click_id,click_time,shorturl,referrer,user_agent,ip_address,country_codeFROMyourls_logWhat I did
// Disable stats writes/reads (expectation) // Español: desactivar estadísticas if ( ! defined( 'YOURLS_NOSTATS' ) ) { define( 'YOURLS_NOSTATS', true ); }`/**
*/
// Español: forzar a que no se actualicen clics
yourls_add_filter( 'shunt_update_clicks', function () {
return true;
} );
`
Despite this, the slow query above keeps showing up.
Expected behavior
When YOURLS_NOSTATS is set (and/or shunt_update_clicks returns true), YOURLS should not query yourls_log at all—or at least should avoid full scans without WHERE/LIMIT.
Actual behavior
A SELECT against yourls_log is executed, returning millions of rows and showing up in mysqldumpslow.
Questions
If not currently possible, would you consider a PR to:
Make YOURLS_NOSTATS also short-circuit all queries to yourls_log, or introduce a new flag (e.g. YOURLS_DISABLE_LOG_QUERIES) / filter to bypass any yourls_log reads?
Environment
YOURLS version: 1.10.1
PHP version: 8.3
MySQL version: mariadb 10.11.14
Traffic level / log table size: ~4.3M rows returned by the observed query
Additional context
I’m not calling stats endpoints; this shows up during normal operation.
Thanks in advance for any guidance or pointers on how to shut off these log queries entirely.
Beta Was this translation helpful? Give feedback.
All reactions