blob: 3f6541640617b78c38dfc85dbb87da1806bbbf35 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001-- Copyright 2016 The Chromium Authors
2-- Use of this source code is governed by a BSD-style license that can be
3-- found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5
6DROP PROCEDURE IF EXISTS NullCommentTableStrings;
7
8delimiter //
9
10CREATE PROCEDURE NullCommentTableStrings(
11 IN in_start INT, IN in_stop INT, IN in_step INT)
12BEGIN
13 comment_loop: LOOP
14 IF in_start >= in_stop THEN
15 LEAVE comment_loop;
16 END IF;
17
18 SELECT in_start AS StartingAt;
19 SELECT count(*)
20 FROM Comment
21 WHERE Comment.id >= in_start
22 AND Comment.id < in_start + in_step;
23
24 UPDATE Comment
25 SET content = NULL, inbound_message = NULL
26 WHERE Comment.id >= in_start
27 AND Comment.id < in_start + in_step;
28
29 SET in_start = in_start + in_step;
30
31 END LOOP;
32
33END;
34
35
36//
37
38
39delimiter ;
40
41
42-- Copy and paste these individually and verify that the site is still responsive.
43-- the first one, takes about 30 sec, then 4-7 minutes for each of the rest.
44-- CALL NullCommentTableStrings( 0, 13 * 1000000, 10000);
45-- CALL NullCommentTableStrings(13 * 1000000, 16 * 1000000, 10000);
46-- CALL NullCommentTableStrings(16 * 1000000, 17 * 1000000, 10000);
47-- CALL NullCommentTableStrings(17 * 1000000, 18 * 1000000, 10000);
48-- CALL NullCommentTableStrings(18 * 1000000, 19 * 1000000, 10000);
49-- CALL NullCommentTableStrings(19 * 1000000, 20 * 1000000, 10000);
50-- CALL NullCommentTableStrings(20 * 1000000, 21 * 1000000, 10000);
51-- CALL NullCommentTableStrings(21 * 1000000, 22 * 1000000, 10000);
52-- CALL NullCommentTableStrings(22 * 1000000, 23 * 1000000, 10000);
53-- CALL NullCommentTableStrings(23 * 1000000, 24 * 1000000, 10000);
54-- CALL NullCommentTableStrings(24 * 1000000, 25 * 1000000, 10000);
55-- CALL NullCommentTableStrings(25 * 1000000, 26 * 1000000, 10000);
56-- CALL NullCommentTableStrings(26 * 1000000, 27 * 1000000, 10000);
57-- CALL NullCommentTableStrings(27 * 1000000, 28 * 1000000, 10000);
58-- CALL NullCommentTableStrings(28 * 1000000, 29 * 1000000, 10000);
59-- CALL NullCommentTableStrings(29 * 1000000, 30 * 1000000, 10000);
60-- CALL NullCommentTableStrings(30 * 1000000, 40 * 1000000, 10000);