[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nss-mysql-devel] [patch #4942] Significant reduction of cpu load when u
[Nss-mysql-devel] [patch #4942] Significant reduction of cpu load when using +2000 in uid/gid lookups
Wed, 1 Mar 2006 12:02:08 +0000
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:184.108.40.206) Gecko/20060124 Firefox/220.127.116.11
Summary: Significant reduction of cpu load when using +2000
in uid/gid lookups
Project: NSS MySQL
Submitted by: None
Submitted on: Wed 03/01/06 at 12:02
Priority: 5 - Normal
Assigned to: None
We are using a query that looks a little like:
WHERE uid + 2000 = 40000
Unfortunately this causes MySQL to completely ignore the index and ends up
using a complete table search... If you don't believe try doing a simple
explain on that query, and then:
WHERE uid = 38000
And you'll see the difference.
The purpose of this patch is to hard code the +2000 part of the query to
remove it from the MySQL query. This greatly increases speed as MySQL can
then use the index.
Secondly, this patch causes a failed query if you look up a uid/gid lower
than 2000 (all system ids for us). These should fail for us anyway in the
database, and should only ever be found in /etc/passwd. This could probably
be done in a better way (at the moment it just adds a WHERE 1=0 clause). It
then subtracts 2000 from the query id and runs the query like normal. This
should produce significant speed improvements if (like us) you have somewhere
in excess of 100,000 users and groups.
This patch is only helpful if you currently specify '+ 2000' or similar in
the config file. After using this patch you'll need to remove the '+ 2000'
from the configuration files. Obviously if you add a different number then
you'll need to alter the patch.
Date: Wed 03/01/06 at 12:02 Name: nss-mysql-uid.patch Size: 5.26KB By:
Reply to this item at:
Message sent via/by Savannah
- [Nss-mysql-devel] [patch #4942] Significant reduction of cpu load when using +2000 in uid/gid lookups,