Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-11660

Automatically create remaining database indexes

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 6.4-rc-1
    • Old Core
    • None
    • Unknown

    Description

      In XWIKI-6685 we modified our HBM files to automatically create DB indexes. However, we still ask users to create some indexes that we though couldn't be created automatically (See http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Database+Administration)

      Namely:

      create index xwl_value on xwikilargestrings (xwl_value(50));
      create index xwd_parent on xwikidoc (xwd_parent(50));
      create index xwd_class_xml on xwikidoc (xwd_class_xml(20));
      create index xws_number on xwikistatsdoc (XWS_NUMBER);
      create index xws_classname on xwikistatsdoc (XWS_CLASSNAME);
      create index xwr_number on xwikistatsreferer (XWR_NUMBER);
      create index xwr_classname on xwikistatsreferer (XWR_CLASSNAME);
      create index xwr_referer on xwikistatsreferer (XWR_REFERER(50));
      create index xwv_user_agent on xwikistatsvisit (XWV_USER_AGENT(255));
      create index xwv_cookie on xwikistatsvisit (XWV_COOKIE(255));
      create index xwv_classname on xwikistatsvisit (XWV_CLASSNAME);
      create index xwv_number on xwikistatsvisit (XWV_NUMBER);
      create index ase_page_date on  activitystream_events (ase_page, ase_date);
      create index xda_docid1 on xwikiattrecyclebin (xda_docid);
      create index ase_param1 on activitystream_events (ase_param1(200));
      create index ase_param2 on activitystream_events (ase_param2(200));
      create index ase_param3 on activitystream_events (ase_param3(200));
      create index ase_param4 on activitystream_events (ase_param4(200));
      create index ase_param5 on activitystream_events (ase_param5(200));
      

      It seems there's a solution for that which is to use Auxiliary Database Objects in our HBM, see https://docs.jboss.org/hibernate/stable/core.old/reference/en/html/mapping-database-object.html See also https://steveswinsburg.wordpress.com/2009/06/16/adding-database-indexes-with-hibernate/ which demonstrates how to use it.

      This will allow us to create all indexes automatically. We might want to scope them with the proper dialect so that the HBM won't fail on DBs having a different index syntax for example.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: