Skip to Content.
Sympa Menu

grouper-dev - RE: grouper 1.4 performance

Subject: Grouper Developers Forum

List archive

RE: grouper 1.4 performance


Chronological Thread 
  • From: Chris Hyzer <>
  • To: "" <>
  • Subject: RE: grouper 1.4 performance
  • Date: Tue, 7 Apr 2009 16:46:36 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

I did these composite refactorings in the API. Before if I made a
requireInGroups composite (intersection) with a group of 40k members, it took
3 minutes on my PC with mysql. Now it takes 2 seconds.

I tagged before I committed: GROUPER_1_4_20090407a

Shilen, if you want to review the code, that would be good. (just diff
branch GROUPER_1_4 with that tag).

All the composite unit tests work, I will kick them all off now.

Also, the #2 idea from that email (to join to the security tables for group
listings) doesn't look like it is necessary... in my test env it looks quick
now (due to my other change I guess). Not really sure though... will check.

Thanks,
Chris

> #########################################
> 3. making a composite (intersection or complement) of a small group and
> a large group. We have a use case where we like to intersect with
> allEmployees or facultyStudentStaff, etc, and it takes a LONG time to
> figure out a few members (since it selects all from each group)... I
> think we can do this all in one query. Also, right now all columns in
> the membership object are returned, then only the ID is used, so we
> only need to select the ID. Here is an example of an intersection,
> complement, and union in one query each (again, proof of concepts in
> the HibernateSessionTest class):
>
> //intersection in one query
> List<String> memberUuids = HibernateSession.byHqlStatic()
> .createQuery("select distinct theMember.uuid from Member
> theMember, " +
> "Membership theMembership, Membership theMembership2,
> Field theField " +
> "where theMembership.ownerUuid = :group1uuid and
> theMembership2.ownerUuid = :group2uuid " +
> "and theMember.uuid = theMembership.memberUuid and
> theMember.uuid = theMembership2.memberUuid " +
> "and theMembership.fieldId = theField.uuid and
> theMembership2.fieldId = theField.uuid " +
> "and theField.typeString = 'list' and theField.name =
> 'members'")
> .setString("group1uuid", i2.getUuid())
> .setString("group2uuid", i3.getUuid())
> .list(String.class);
>
> assertEquals(1, memberUuids.size());
> assertEquals(MemberFinder.findBySubject(grouperSession,
> SubjectTestHelper.SUBJ1).getUuid(), memberUuids.get(0));
>
> //complement in one query
> memberUuids = HibernateSession.byHqlStatic()
> .createQuery("select distinct theMember.uuid from Member theMember,
> " +
> "Membership theMembership, Field theField " +
> "where theMembership.ownerUuid = :group1uuid " +
> "and theMember.uuid = theMembership.memberUuid " +
> "and theMembership.fieldId = theField.uuid " +
> "and theField.typeString = 'list' and theField.name = 'members'
> " +
> "and not exists (select theMembership2.memberUuid from
> Membership theMembership2 " +
> "where theMembership2.memberUuid = theMember.uuid and
> theMembership.fieldId = theField.uuid " +
> "and theMembership2.ownerUuid = :group2uuid) ")
> .setString("group1uuid", i3.getUuid())
> .setString("group2uuid", i2.getUuid())
> .list(String.class);
>
> assertEquals(1, memberUuids.size());
> assertEquals(MemberFinder.findBySubject(grouperSession,
> SubjectTestHelper.SUBJ4).getUuid(), memberUuids.get(0));
>
> //union in one query (granted, this is less of an issue since you
> need all data from both,
> //but might as well be consistent)
> memberUuids = HibernateSession.byHqlStatic()
> .createQuery("select distinct theMember.uuid from Member theMember,
> " +
> "Membership theMembership, Membership theMembership2, Field
> theField " +
> "where theMembership.ownerUuid = :group1uuid and
> theMembership2.ownerUuid = :group2uuid " +
> "and (theMember.uuid = theMembership.memberUuid or
> theMember.uuid = theMembership2.memberUuid) " +
> "and theMembership.fieldId = theField.uuid and
> theMembership2.fieldId = theField.uuid " +
> "and theField.typeString = 'list' and theField.name =
> 'members'")
> .setString("group1uuid", i2.getUuid())
> .setString("group2uuid", i3.getUuid())
> .list(String.class);
>
> assertEquals(6, memberUuids.size());



Archive powered by MHonArc 2.6.16.

Top of Page