From 390dc7737ba260e6ed390d90b9cec1309cdd2ad2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 23 May 2004 17:51:41 +0000 Subject: [PATCH] performance patch: indices for the calendar --- calendar/setup/setup.inc.php | 2 +- calendar/setup/tables_current.inc.php | 18 +++---- calendar/setup/tables_update.inc.php | 72 +++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 10 deletions(-) diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index 820fb1cf5b..c2efcc5581 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -12,7 +12,7 @@ /* $Id$ */ $setup_info['calendar']['name'] = 'calendar'; - $setup_info['calendar']['version'] = '0.9.16.002'; + $setup_info['calendar']['version'] = '0.9.16.005'; $setup_info['calendar']['app_order'] = 3; $setup_info['calendar']['enable'] = 1; diff --git a/calendar/setup/tables_current.inc.php b/calendar/setup/tables_current.inc.php index b12f4f3908..f30fbd9e8b 100644 --- a/calendar/setup/tables_current.inc.php +++ b/calendar/setup/tables_current.inc.php @@ -48,32 +48,32 @@ ), 'pk' => array('hol_id'), 'fk' => array(), - 'ix' => array(), + 'ix' => array('locale'), 'uc' => array() ), 'phpgw_cal_repeats' => array( 'fd' => array( 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), - 'recur_use_end' => array('type' => 'int','precision' => '8','nullable' => True,'default' => '0'), - 'recur_enddate' => array('type' => 'int','precision' => '8','nullable' => True), - 'recur_interval' => array('type' => 'int','precision' => '8','nullable' => True,'default' => '1'), - 'recur_data' => array('type' => 'int','precision' => '8','nullable' => True,'default' => '1'), - 'recur_exception' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => '') + 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), + 'recur_enddate' => array('type' => 'int','precision' => '8'), + 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') ), 'pk' => array(), 'fk' => array(), - 'ix' => array(), + 'ix' => array('cal_id'), 'uc' => array() ), 'phpgw_cal_user' => array( 'fd' => array( 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), - 'cal_status' => array('type' => 'char','precision' => '1','nullable' => True,'default' => 'A'), + 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') ), - 'pk' => array('cal_id','cal_login'), + 'pk' => array('cal_id','cal_login','cal_type'), 'fk' => array(), 'ix' => array(), 'uc' => array() diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php index 67231eba2d..431ad70073 100644 --- a/calendar/setup/tables_update.inc.php +++ b/calendar/setup/tables_update.inc.php @@ -958,4 +958,76 @@ $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.002'; return $GLOBALS['setup_info']['calendar']['currentver']; } + + + // the following series of updates add some indices, to speedup the selects + + $test[] = '0.9.16.002'; + function calendar_upgrade0_9_16_002() + { + $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), + 'recur_enddate' => array('type' => 'int','precision' => '8'), + 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') + ), + 'pk' => array(), + 'fk' => array(), + 'ix' => array('cal_id'), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; + } + + + $test[] = '0.9.16.003'; + function calendar_upgrade0_9_16_003() + { + $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_cal_user',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), + 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') + ), + 'pk' => array('cal_id','cal_login','cal_type'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; + } + + + $test[] = '0.9.16.004'; + function calendar_upgrade0_9_16_004() + { + $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( + 'fd' => array( + 'hol_id' => array('type' => 'auto','nullable' => False), + 'locale' => array('type' => 'char','precision' => '2','nullable' => False), + 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), + 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') + ), + 'pk' => array('hol_id'), + 'fk' => array(), + 'ix' => array('locale'), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; + } ?>