Here you are
$ psql -c "EXPLAIN DELETE FROM session WHERE authenticated=0 AND
last_visit<1504216800;"
QUERY PLAN
---------------------------------------------------------------------
Delete on session (cost=0.00..931.79 rows=1506 width=6)
-> Seq Scan on session (cost=0.00..931.79 rows=1506 width=6)
Filter: ((last_visit < 1504216800) AND (authenticated = 0))
$ psql -c "EXPLAIN DELETE FROM session_attribute WHERE authenticated=0 AND sid NOT
IN (SELECT sid FROM session WHERE authenticated=0);"
QUERY PLAN
-------------------------------------------------------------------------------
Delete on session_attribute (cost=926.96..3379.66 rows=7889 width=6)
-> Seq Scan on session_attribute (cost=926.96..3379.66 rows=7889 width=6)
Filter: ((NOT (hashed SubPlan 1)) AND (authenticated = 0))
SubPlan 1
-> Seq Scan on session (cost=0.00..901.83 rows=10052 width=22)
Filter: (authenticated = 0)
It's probably not as informative as it could be after my last purge of
anonymous sessions.
Nicolas
On 07/11/2017 03:54, Jun Omae wrote:
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);
====
--
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.