On Tue, Nov 7, 2017 at 2:52 AM, Nicolas MARTIN <[email protected]> wrote:
> $ time trac-admin ~/trac/ session purge "09/01/17 00:00:00"
> 18:34:31 Trac[env] INFO: -------------------------------- environment
> startup [Trac 1.0.1] --------------------------------
> ...
> 18:34:32 Trac[util] DEBUG: SQL:
>                 DELETE FROM session
>                 WHERE authenticated=0 AND last_visit<%s
>
> 18:34:32 Trac[util] DEBUG: args: (1504216800,)
> 18:34:32 Trac[util] DEBUG: SQL:
>                 DELETE FROM session_attribute
>                 WHERE authenticated=0
>                       AND sid NOT IN (SELECT sid FROM session
>                                       WHERE authenticated=0)
> real    1m55.482s
> user    0m0.790s
> sys    0m0.090s
>
> [nemo@forge ~]$ psql -c "SELECT COUNT(*) FROM session;"
>  count
> -------
>  32116
>
> I'm quite a newbie in SQL stuff but from my standpoint these 2 minutes are
> much too long for parsing the database.
>
> Couldn't we have a hidden issue here ?

Could you please share results of the following explain queries?

====
EXPLAIN DELETE FROM session WHERE authenticated=0 AND last_visit<1504216800;

EXPLAIN DELETE FROM session_attribute
        WHERE authenticated=0
        AND sid NOT IN (SELECT sid FROM session WHERE authenticated=0);
====

-- 
Jun Omae <[email protected]> (大前 潤)

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to