two more indexes to speed up sync

This commit is contained in:
Ralf Becker 2010-04-14 12:23:47 +00:00
parent e0c80bc1c9
commit 3123d9c2e2
3 changed files with 33 additions and 13 deletions

View File

@ -10,7 +10,7 @@
*/ */
$setup_info['calendar']['name'] = 'calendar'; $setup_info['calendar']['name'] = 'calendar';
$setup_info['calendar']['version'] = '1.7.008'; $setup_info['calendar']['version'] = '1.7.010';
$setup_info['calendar']['app_order'] = 3; $setup_info['calendar']['app_order'] = 3;
$setup_info['calendar']['enable'] = 1; $setup_info['calendar']['enable'] = 1;
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index'; $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index';
@ -65,8 +65,3 @@ $setup_info['calendar']['check_install'] = array(
'from' => 'Calendar', 'from' => 'Calendar',
), ),
); );

View File

@ -34,7 +34,7 @@ $phpgw_baseline = array(
), ),
'pk' => array('cal_id'), 'pk' => array('cal_id'),
'fk' => array(), 'fk' => array(),
'ix' => array(), 'ix' => array('cal_uid','cal_owner'),
'uc' => array() 'uc' => array()
), ),
'egw_cal_holidays' => array( 'egw_cal_holidays' => array(

View File

@ -1653,7 +1653,7 @@ function calendar_upgrade1_6()
',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__);
} }
} }
// Search series exception for nearest exception in series master and add that RECURRENCE-ID // Search series exception for nearest exception in series master and add that RECURRENCE-ID
// as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001)
foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal
@ -1728,7 +1728,7 @@ function calendar_upgrade1_6_003()
'default' => '0', 'default' => '0',
'comment' => 'cal_start of original recurrence for exception' 'comment' => 'cal_start of original recurrence for exception'
)); ));
// move RECURRENCE-ID from temporarily (1.6.003) // move RECURRENCE-ID from temporarily (1.6.003)
// used field cal_reference to new field cal_recurrence // used field cal_reference to new field cal_recurrence
// and restore cal_reference field of series exceptions with id of the series master // and restore cal_reference field of series exceptions with id of the series master
@ -1745,7 +1745,7 @@ function calendar_upgrade1_6_003()
', cal_reference='.(int)$row['cal_id_master']. ', cal_reference='.(int)$row['cal_id_master'].
' WHERE cal_id='.(int)$row['cal_id_ex']); ' WHERE cal_id='.(int)$row['cal_id_ex']);
} }
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.001'; return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.001';
} }
@ -2011,17 +2011,17 @@ function calendar_upgrade1_7_006()
$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59
WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
} }
foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates
WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row)
{ {
$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1
WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
} }
$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
WHERE recur_interval=0',__LINE__,__FILE__); WHERE recur_interval=0',__LINE__,__FILE__);
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007';
} }
@ -2051,3 +2051,28 @@ function calendar_upgrade1_7_007()
} }
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008';
} }
/**
* Create an index over egw_cal_user.cal_user_type and cal_user_id, to speed up calendar queries
*
* @return string
*/
function calendar_upgrade1_7_008()
{
$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id'));
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009';
}
/**
* Create an index over egw_cal.cal_uid and cal_owner, to speed up calendar queries specially sync
*
* @return string
*/
function calendar_upgrade1_7_009()
{
$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid');
$GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner');
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010';
}