Score Feature - Slow Database Queries
- Status
- Open
- Subject
- Score Feature - Slow Database Queries
- Version
- 15.x
18.x
21.x
22.x
23.x - Category
- Error
- Feature
- Score
- Resolution status
- Accepted
- Submitted by
- albertgi
- Lastmod by
- albertgi
- Rating
- Description
It seems that the greater the number of users exist in the wiki, tied with a higher total score per user, generates very slow queries to the database, resulting in a very slow load time per page. I was experiencing 20 seconds + of load time per wiki page, as it was loading the scoring table every time.
Some samples from the database (not sure if useful).
- Time: 170131 16:54:54
- User@Host: giswikiadmgiswikiadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 334497
- Query_time: 28.076675 Lock_time: 0.000208 Rows_sent: 10 Rows_examined: 4229506
SET timestamp=1485899694;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- User@Host: eiadwikiadmeiadwikiadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 344609
- Query_time: 21.994789 Lock_time: 0.000448 Rows_sent: 10 Rows_examined: 3325313
SET timestamp=1485955286;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- Time: 170201 8:21:56
- User@Host: eiadwikiadmeiadwikiadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 344614
- Query_time: 22.215687 Lock_time: 0.000448 Rows_sent: 10 Rows_examined: 3325313
SET timestamp=1485955316;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- Time: 170201 8:22:42
- User@Host: eiadwikiadmeiadwikiadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 344620
- Query_time: 21.846001 Lock_time: 0.000245 Rows_sent: 10 Rows_examined: 3325313
SET timestamp=1485955362;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- Time: 170201 8:23:33
- User@Host: citypediaadmcitypediaadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 344638
- Query_time: 12.665043 Lock_time: 0.000552 Rows_sent: 10 Rows_examined: 2035464
use citypediap1;
SET timestamp=1485955413;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- Time: 170201 8:23:44
- User@Host: eiadwikiadmeiadwikiadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 344639
- Query_time: 22.066348 Lock_time: 0.000236 Rows_sent: 10 Rows_examined: 3325313
use eiadwikip1;
SET timestamp=1485955424;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- Time: 170201 8:23:52
- User@Host: citypediaadmcitypediaadm @ clwp001.city.a.ottawa.ca 10.140.12.238 Id: 344642
- Query_time: 13.027229 Lock_time: 0.000440 Rows_sent: 10 Rows_examined: 2035464
use citypediap1;
SET timestamp=1485955432;
select `recipientObjectId` as `login`,
`pointsBalance` as `score`
from `tiki_object_scores` tos
where `recipientObjectType`='user'
and tos.`id` = (select max(id) from `tiki_object_scores` where `recipientObjectId` = tos.`recipientObjectId` and `recipientObjectType`='user' group by `recipientObjectId`)
group by `recipientObjectId` order by `score` desc LIMIT 10 OFFSET 0;- Workaround
- Disabled the score module
- Importance
- 6
- Priority
- 30
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 6271
- Created
- Thursday 02 February, 2017 16:16:15 UTC
by albertgi - LastModif
- Thursday 18 February, 2021 17:00:42 UTC