Project

General

Profile

Actions

Bug #7997

closed

Username and alias exists check too slow

Added by krileon over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
06 May 2020
Due date:
% Done:

100%

Estimated time:

Description

The check to see if a username or alias exists is too slow. With 1 million users this takes 4 seconds or more. Query as follows.

SELECT u.`id` FROM `jos_comprofiler` AS c INNER JOIN `jos_users` AS u ON u.`id` = c.`id` WHERE ( u.`username` = 'test' OR c.`alias` = 'test' ) LIMIT 0, 1

This becomes significantly faster (few milliseconds) if it's broken into 2 queries instead of a join. Needs further testing to find the most optimal query for checking this.

https://www.joomlapolis.com/forum/255-developer-members-support/242464-some-communiy-builder-running-which-does-not-clear#318292

Actions #1

Updated by krileon over 4 years ago

This is exponentially faster.. 100x faster even.. splitting the query into 2 optimized queries. The two queries being combined in a join is only fast if it finds a user.

Actions #2

Updated by krileon over 4 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Fixed in MR !1553

Actions #3

Updated by beat over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF