Skip to content

Commit

Permalink
Merge pull request #19 from Pandos/dev
Browse files Browse the repository at this point in the history
Key update to prevent possible slow query from a large session table -- when doing session writing or garbage collection.
  • Loading branch information
Nao committed Aug 18, 2014
2 parents 5097534 + 355e403 commit c26851b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions core/app/Upgrade.php
Expand Up @@ -95,3 +95,12 @@ function upgrade_step_3()
{
return wedb::drop_table('{db_prefix}log_boards');
}

// 1.0-alpha-1, July 2014. Adding index to sessions to prevent a possible slow query.
function upgrade_step_4()
{
$request = wesql::query('
ALTER TABLE
{db_prefix}sessions
ADD KEY last_update (last_update)');
}
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -12,7 +12,7 @@
return;

define('WEDGE_VERSION', '1.0-beta');
define('WEDGE', 3); // Internal snapshot number.
define('WEDGE', 4); // Internal snapshot number.

// Get everything started up...
if (version_compare(PHP_VERSION, '5.3') < 0)
Expand Down
3 changes: 2 additions & 1 deletion install/install.sql
Expand Up @@ -2068,7 +2068,8 @@ CREATE TABLE {$db_prefix}sessions (
session_id char(32) NOT NULL,
last_update int(10) unsigned NOT NULL,
data text NOT NULL,
PRIMARY KEY (session_id)
PRIMARY KEY (session_id),
KEY last_update (last_update)
) ENGINE=MyISAM;

#
Expand Down

0 comments on commit c26851b

Please sign in to comment.