Back to this thread, I launched a anonymous sessions purge with your
recommended options:
$ psql -c "SELECT COUNT(*) FROM session;"
count
-------
32107
$ time trac-admin ~/trac/ session purge "01/01/15 00:00:00"
17:43:22 Trac[env] INFO: -------------------------------- environment startup
[Trac 1.0.1] --------------------------------
...
17:43:23 Trac[util] DEBUG: SQL:
DELETE FROM session
WHERE authenticated=0 AND last_visit<%s
17:43:23 Trac[util] DEBUG: args: (1420066800,)*
17:43:23 Trac[util] DEBUG: SQL:
DELETE FROM session_attribute
WHERE authenticated=0
AND sid NOT IN (SELECT sid FROM session
WHERE authenticated=0)
real 1m54.222s
user 0m0.760s
sys 0m0.120s
$ psql -c "SELECT COUNT(*) FROM session;"
count
-------
32108
It took all the time (~2 mns) in the second DELETE operation because it
wasn't expecting to find a session previous to 01-01-2015.
I have repeated the same command third times with a similar running time.
Then I modified the command to remove anonymous sessions from last
September and it took almost the same time
$ 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 ?
On 11/10/2017 20:26, RjOllos wrote:
On Wednesday, October 11, 2017 at 3:33:23 AM UTC-7, Nicolas MARTIN wrote:
There was no surprise regarding the number of sessions removed
(almost zero), the site has been released publicly a few months ago.
My command was just for testing purpose but I didn't expect it
would take some much time with no substantial operations on the db.
In fact, we have a mean of 500 sessions created per day since
putting it online. I decided to cut by half and kept the sessions
only since September,
I'm not sure if we have an interest of keeping them.
The weird thing is that the command took about 4 mins while
parsing the same number of sessions.
Nicolas
You could see what queries are being executed by setting:
[logging]
log_level = DEBUG
[trac]
debug_sql = enabled
You should get just two queries:
11:23:58 Trac[util] DEBUG: SQL:
DELETE FROM session
WHERE authenticated=0 AND last_visit<%s
11:23:58 Trac[util] DEBUG: args: (1444674238,)
11:23:58 Trac[util] DEBUG: prefetch: 0 rows
11:23:58 Trac[util] DEBUG: SQL:
DELETE FROM session_attribute
WHERE authenticated=0
AND sid NOT IN (SELECT sid FROM session
WHERE authenticated=0)
- Ryan
--
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 trac-users+unsubscr...@googlegroups.com
<mailto:trac-users+unsubscr...@googlegroups.com>.
To post to this group, send email to trac-users@googlegroups.com
<mailto:trac-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
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 trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.