grouper-users - [grouper-users] Oracle performance with membership queries, and histogram statistics
Subject: Grouper Users - Open Discussion List
List archive
[grouper-users] Oracle performance with membership queries, and histogram statistics
Chronological Thread
- From: "Redman, Chad" <>
- To: Cisco ROS <>
- Subject: [grouper-users] Oracle performance with membership queries, and histogram statistics
- Date: Mon, 3 Feb 2020 18:58:26 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=unc.edu; dmarc=pass action=none header.from=unc.edu; dkim=pass header.d=unc.edu; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bt+pl+UjOSGM1JmEu1NF0M0piLmdZQzBUwqu8v692cQ=; b=V6EzWBbP5rx+RtZ/gT5OO647AS6FuXUcERTfrmtrMn9nbeivR91NIjk/EogInQoz2N9aGmPqX2WSeiyNp7UyLeWkrgefjqTMiYhm4px3gTeujybHbhbkPLIl7DdZmBuUmwCnTR9cUFnbmHx9493TbS8gPfGs8JWxXQlz/B/BS9iM9Rj7YN9yKJHMxseUrZ1rWh34lCdwGEdkE3wdjR8P/HKH7Cj55+I54caEBPxIScadG/emWBmlst5JU/9leI7Z1Y6VoJdBM4swiB7UyvCD0+HIwbbnDMd0XnMn23t8UsPisYvNIb4jt+HMpaBN59xcKrxP+Cj79M+EhtNcM1Sr/w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2U2j9ImSRyjvWyHUm7T64E+ur8e2lSpOQBAFmU/plMmvN/zBelt7uZ8r1bVYDof3RCQiC3V/wiwqpfMXtSDGumr23MZsCDonoDSYcjKKZvf5vfs3q/sArorN+oG5gCGk/IsucDJji6pbm7u1iU+Bj/Zy/PrCwKHpRW30rcJN5c8hPDuwrROCgxD7ySyT5uly564G+IUECas39z8fghU8n8uYIW/NsTxltBT7Zm7jjfgoZ6MTxx/8awwtHcASnDFCdMnLEP9W4M/MviMYlv6BYjg9qmkRRvufnnF4oM5Qmu+ei1dfV7Chwq3DDK3LDPwZArkmOulF6M99npkHEWY2Q==
I wanted to send out a note on a performance issue that we had in Oracle, which we fixed. We had been getting complaints that some UI actions were slow recently. As a wheel group user in Grouper, I rarely see any of these issues, so it took a non-wheel user
going through a live demo of normal UI actions, that made the issue clear. The left navbar folder navigation has always been somewhat slow for users, even with security.show.folders.where.user.can.see.subobjects=false to skip empty folder checking. But the
subject/group search bar was really bad, around 1.5 to 2 minutes to do a basic search for a group by name -- enough to time out regularly.
I identified one query was likely causing the problem. It was querying the groups by the search term, but also linking to the user's privileges, to make sure it only returned groups the user could read. The way Oracle reported its query plan, it thought that
querying the memberships first would narrow the cardinality to 16 rows, small enough that it could do nested loops and table scans for all the other query steps. Since we have 1 million rows in grouper_memberships but 100,000 unique members, this wasn't an
unreasonable assumption. But in actuality, the "EveryEntity/GrouperAll" subject had view or read privileges on 35,000 groups. So the query was looping and table scanning 2,000 times more than it expected.
Oracle not only collects table statistics, but it also has a feature to maintain histogram data on columns. Values are put into a fixed number of bins. If the column data is heavily skewed toward one value, that value will occupy one or more bins by itself,
and the query analysis can use that information to get a rough estimate on the cardinality of a filter on that column.
In our case, we simply added a histogram statistic on GROUPER_MEMBERSHIPS.MEMBER_ID:
BEGIN
DBMS_STATS.GATHER_TABLE_STATS (
ownname => 'GROUPER'
, tabname => 'GROUPER_MEMBERSHIPS'
, method_opt => 'FOR COLUMNS MEMBER_ID'
);
END;
After that, the query went from 1.5 minutes to 4-8 seconds. The user reported not only that groups searches by name were now taking 8 seconds instead of timing out after 2 minutes, but the folder tree navigation was now instantaneous!
-Chad
- [grouper-users] Oracle performance with membership queries, and histogram statistics, Redman, Chad, 02/03/2020
Archive powered by MHonArc 2.6.19.