Permalink
Browse files

Item14037: Add an index on to_topic

Updates to the dependencies table were resulting in a sequential table
scan.   On foswiki.org it was > 7 million rows, and resulting in
30+ seconds of delay during topic save.
  • Loading branch information...
1 parent c1b2068 commit 790c4d37b2fb4d18600c827b1e143ec57a0eafb0 @gac410 gac410 committed Apr 4, 2016
@@ -1,4 +1,4 @@
-%META:TOPICINFO{author="ProjectContributor" date="1455156569" format="1.1" version="1"}%
+%META:TOPICINFO{author="ProjectContributor" date="1459790135" format="1.1" version="1"}%
%META:TOPICPARENT{name="AdminDocumentationCategory"}%
---+!! Page Caching
How to get the best from HTML Caching.
@@ -253,17 +253,24 @@ Before Foswiki is able to use !MySQL for caching, several conditions must be met
Enter password: ........
Welcome to the MySQL monitor. Commands end with ; or \g.
- mysql> create database foswiki;
+ mysql> create database foswiki_db;
Query OK, 1 row affected (0.00 sec)
mysql> grant usage on *.* to foswiki@localhost identified by 'foswikipass';
Query OK, 0 rows affected (0.00 sec)
- mysql> grant all privileges on foswiki.* to foswiki@localhost ;
+ mysql> grant all privileges on foswiki_db.* to foswiki@localhost ;
Query OK, 0 rows affected (0.00 sec)
+
+ mysql> FLUSH PRIVILEGES;
+ Query OK, 0 rows affected (0.00 sec)
+
+ mysql> exit
+ Bye
+
</verbatim>
* Foswiki must be configured with the database, user and password information. For example:
- * ={Cache}{DBI}{MySQL}{Database} = 'foswiki';=
+ * ={Cache}{DBI}{MySQL}{Database} = 'foswiki_db';=
* ={Cache}{DBI}{MySQL}{Host} = 'localhost';=
* ={Cache}{DBI}{MySQL}{Password} = 'foswikipass';=
* ={Cache}{DBI}{MySQL}{Port} = '';=
@@ -1,4 +1,4 @@
-%META:TOPICINFO{author="ProjectContributor" date="1457496285" format="1.1" version="1"}%
+%META:TOPICINFO{author="ProjectContributor" date="1459790135" format="1.1" version="1"}%
%META:TOPICPARENT{name="ReleaseHistory"}%
---+!! Foswiki Release 2.1.0
@@ -77,6 +77,12 @@ However the TinyMCEPlugin is still unable to render image links while editing a
See [[%BUGS%/Item13696][Item13696]] for up-to-date details.
+---++ Important changes in Foswiki 2.1.1
+
+The Foswiki PageCache has added another index on the dependencies table.
+After installing this update, in addition to refreshing the cache, you should
+drop the foswiki cache tables, and allow them to be recreated.
+
---++ Important changes in Foswiki 2.1
---+++ Deprecations
@@ -49,10 +49,11 @@ sub new {
username => $Foswiki::cfg{Cache}{DBI}{Username},
password => $Foswiki::cfg{Cache}{DBI}{Password},
- pagesTable => $tablePrefix . '_pages',
- pagesIndex => $tablePrefix . '_pages_index',
- depsTable => $tablePrefix . '_deps',
- depsIndex => $tablePrefix . '_deps_index',
+ pagesTable => $tablePrefix . '_pages',
+ pagesIndex => $tablePrefix . '_pages_index',
+ depsTable => $tablePrefix . '_deps',
+ depsIndex => $tablePrefix . '_deps_index',
+ depsTopicIndex => $tablePrefix . '_deps_topics_index',
@_
};
@@ -633,6 +634,10 @@ HERE
$this->{dbh}->do(
"create index $this->{depsIndex} on $this->{depsTable} (from_topic, to_topic)"
);
+
+ $this->{dbh}->do(
+ "create index $this->{depsTopicIndex} on $this->{depsTable} (to_topic)"
+ );
}
=begin TML
@@ -86,6 +86,10 @@ HERE
$this->{dbh}->do(
"create index $this->{depsIndex} on $this->{depsTable} (from_topic, to_topic)"
);
+
+ $this->{dbh}->do(
+ "create index $this->{depsTopicIndex} on $this->{depsTable} (to_topic)"
+ );
}
1;

0 comments on commit 790c4d3

Please sign in to comment.