Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-7239

Slow performance viewing Admin Workspace Resources

    XMLWordPrintable

    Details

      Description

      Queries like this are showing up in the mysql slow query log:

      select count(IN_COLLECTION) from CONTENT_RESOURCE where IN_COLLECTION like '/group/%'
      select count(IN_COLLECTION) from CONTENT_RESOURCE where IN_COLLECTION like '/%'

      Experimentation with mysql 4.1 shows that these are faster when written using LEFT, e.g.

      select count(IN_COLLECTION) from CONTENT_RESOURCE where LEFT(IN_COLLECTION,7)='/group/'
      select count(IN_COLLECTION) from CONTENT_RESOURCE where LEFT(IN_COLLECTION,1)='/'

      The relevant code that should be changed is in content/content-impl/impl/src/java/org/sakaiproject/content/impl/BaseContentService.java:

      public int getCollectionSize(String id) throws IdUnusedException, TypeException, PermissionException
      {

      String wildcard;

      if (id.endsWith("/"))

      { wildcard = id + "%"; }

      else

      { wildcard = id + "/%"; }

      int fileCount = countQuery("select count(IN_COLLECTION) from CONTENT_RESOURCE where IN_COLLECTION like ?", wildcard);
      int folderCount = countQuery("select count(IN_COLLECTION) from CONTENT_COLLECTION where IN_COLLECTION like ?", wildcard);;
      return fileCount + folderCount;
      }

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  Unassigned Unassigned
                  Reporter:
                  smarquard Stephen Marquard
                  Votes:
                  2 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration