[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nss-mysql-devel] [patch #4942] Significant reduction of cpu load when u
From: |
anonymous |
Subject: |
[Nss-mysql-devel] [patch #4942] Significant reduction of cpu load when using +2000 in uid/gid lookups |
Date: |
Wed, 1 Mar 2006 12:02:08 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060124 Firefox/1.5.0.1 |
URL:
<http://savannah.nongnu.org/patch/?func=detailitem&item_id=4942>
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
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
_______________________________________________________
Details:
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.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Wed 03/01/06 at 12:02 Name: nss-mysql-uid.patch Size: 5.26KB By:
None
Patch file
<http://savannah.nongnu.org/patch/download.php?item_id=4942&item_file_id=6002>
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?func=detailitem&item_id=4942>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [Nss-mysql-devel] [patch #4942] Significant reduction of cpu load when using +2000 in uid/gid lookups,
anonymous <=