[history] remove column history.summarized #513

Closed
opened 2026-10-05 00:01:51 +02:00 by adam · 1 comment
Owner

Thanks to #509 and history summary optimization, the column history.summarized is no longer used. We didn't remove it on Piwigo 2.9 to avoid impacting millions of lines on a full history table. Now that #370 was implemented and ran on 2.9, the history table should be much smaller and removing the useless column will be faster.

Thanks to #509 and history summary optimization, the column history.summarized is no longer used. We didn't remove it on Piwigo 2.9 to avoid impacting millions of lines on a full history table. Now that #370 was implemented and ran on 2.9, the history table should be much smaller and removing the useless column will be faster. <!-- github-sync-id:191747122 -->
adam closed this issue 2026-10-05 00:01:51 +02:00
Author
Owner

Hello,

I tried to upgrade from 2.8 to 2.9.1.
My last database upgrade id is 149.

on the next one 150 script you have that:

38 $query = '
39 SELECT
40 *
41 FROM '.PREFIX_TABLE.'history
42 WHERE summarized = 'true'
43 ORDER BY id DESC
44 LIMIT 1
45 ;';

but the summarized column does not exists ... and so the upgrade is failing

Full stack.
[Sun Jun 25 20:56:25.065255 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP Stack trace:, referer: https://ks3370956.kimsufi.com/piwigo/upgrade.php
[Sun Jun 25 20:56:25.065307 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 1. {main}() /var/www/piwigo/upgrade.php:0, referer: https://ks3370956.kimsufi.com/piwigo/upgrade.php
[Sun Jun 25 20:56:25.065405 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 2. include() /var/www/piwigo/upgrade.php:399, referer: https://ks3370956.kimsufi.com/piwigo/upgrade.php
[Sun Jun 25 20:56:25.065778 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 3. include() /var/www/piwigo/install/upgrade_2.8.0.php:109, referer: https://ks3370956.kimsufi.com/piwigo/upgra
de.php
[Sun Jun 25 20:56:25.065990 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 4. query2array() /var/www/piwigo/install/db/150-database.php:47, referer: https://ks3370956.kimsufi.com/piwigo/
upgrade.php
[Sun Jun 25 20:56:25.066187 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 5. pwg_query() /var/www/piwigo/include/dblayer/functions_mysqli.inc.php:886, referer: https://ks3370956.kimsufi
.com/piwigo/upgrade.php
[Sun Jun 25 20:56:25.066384 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 6. my_error() /var/www/piwigo/include/dblayer/functions_mysqli.inc.php:147, referer: https://ks3370956.kimsufi.
com/piwigo/upgrade.php
[Sun Jun 25 20:56:25.066578 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 7. trigger_error() /var/www/piwigo/include/dblayer/functions_mysqli.inc.php:845, referer: https://ks3370956.kim
sufi.com/piwigo/upgrade.php
[Sun Jun 25 20:56:25.067187 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /var/www/piwigo/include/dblay
er/functions_mysqli.inc.php:911\nStack trace:\n#0 /var/www/piwigo/install/db/150-database.php(47): query2array('\nSELECT\n *\n ...')\n#1 /var/www/piwigo/install/upgrade_2.8.0.php(109): include('
/var/www/piwigo...')\n#2 /var/www/piwigo/upgrade.php(399): include('/var/www/piwigo...')\n#3 {main}\n thrown in /var/www/piwigo/include/dblayer/functions_mysqli.inc.php on line 911, referer: https://
ks3370956.kimsufi.com/piwigo/upgrade.php

I post here because it seems to come from the fact that column does not exists. When has it been dropped?

For kwnowledge purpose only, I commented out from the 150 script the full block, and it worked like a charm (but I don't yet the side effect(s) if any...)

/*
39 $query = '
40 SELECT
41 *
42 FROM '.PREFIX_TABLE.'history
43 WHERE summarized = 'true'
44 ORDER BY id DESC
45 LIMIT 1
46 ;';
47 // note : much faster than searching MAX(ID), ie on my big sample 14 seconds Vs 2 seconds
48 $history_lines = query2array($query);
49 if (count($history_lines) > 0)
50 {
51 $last_summarized = $history_lines[0];
52
53 list($year, $month, $day) = explode('-', $last_summarized['date']);
54 list($hour) = explode(':', $last_summarized['time']);
55
56 single_update(
57 PREFIX_TABLE.'history_summary',
58 array(
59 'history_id_to' => $last_summarized['id'],
60 ),
61 array(
62 'year' => $year,
63 'month' => $month,
64 'day' => $day,
65 'hour' => $hour,
66 )
67 );
68
69 // in case this script would update no summary line, it would mean the
70 // summary has been purged and will be rebuild from scratch, based on the
71 // content of history table
72 }
73 */

Hello, I tried to upgrade from 2.8 to 2.9.1. My last database upgrade id is 149. on the next one 150 script you have that: 38 $query = ' 39 SELECT 40 * 41 FROM '.PREFIX_TABLE.'history 42 WHERE summarized = \'true\' 43 ORDER BY id DESC 44 LIMIT 1 45 ;'; but the summarized column does not exists ... and so the upgrade is failing Full stack. [Sun Jun 25 20:56:25.065255 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP Stack trace:, referer: https://ks3370956.kimsufi.com/piwigo/upgrade.php [Sun Jun 25 20:56:25.065307 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 1. {main}() /var/www/piwigo/upgrade.php:0, referer: https://ks3370956.kimsufi.com/piwigo/upgrade.php [Sun Jun 25 20:56:25.065405 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 2. include() /var/www/piwigo/upgrade.php:399, referer: https://ks3370956.kimsufi.com/piwigo/upgrade.php [Sun Jun 25 20:56:25.065778 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 3. include() /var/www/piwigo/install/upgrade_2.8.0.php:109, referer: https://ks3370956.kimsufi.com/piwigo/upgra de.php [Sun Jun 25 20:56:25.065990 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 4. query2array() /var/www/piwigo/install/db/150-database.php:47, referer: https://ks3370956.kimsufi.com/piwigo/ upgrade.php [Sun Jun 25 20:56:25.066187 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 5. pwg_query() /var/www/piwigo/include/dblayer/functions_mysqli.inc.php:886, referer: https://ks3370956.kimsufi .com/piwigo/upgrade.php [Sun Jun 25 20:56:25.066384 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 6. my_error() /var/www/piwigo/include/dblayer/functions_mysqli.inc.php:147, referer: https://ks3370956.kimsufi. com/piwigo/upgrade.php [Sun Jun 25 20:56:25.066578 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP 7. trigger_error() /var/www/piwigo/include/dblayer/functions_mysqli.inc.php:845, referer: https://ks3370956.kim sufi.com/piwigo/upgrade.php [Sun Jun 25 20:56:25.067187 2017] [:error] [pid 6568] [client 83.134.73.234:54135] PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /var/www/piwigo/include/dblay er/functions_mysqli.inc.php:911\nStack trace:\n#0 /var/www/piwigo/install/db/150-database.php(47): query2array('\\nSELECT\\n *\\n ...')\n#1 /var/www/piwigo/install/upgrade_2.8.0.php(109): include(' /var/www/piwigo...')\n#2 /var/www/piwigo/upgrade.php(399): include('/var/www/piwigo...')\n#3 {main}\n thrown in /var/www/piwigo/include/dblayer/functions_mysqli.inc.php on line 911, referer: https:// ks3370956.kimsufi.com/piwigo/upgrade.php I post here because it seems to come from the fact that column does not exists. When has it been dropped? For kwnowledge purpose only, I commented out from the 150 script the full block, and it worked like a charm (but I don't yet the side effect(s) if any...) /* 39 $query = ' 40 SELECT 41 * 42 FROM '.PREFIX_TABLE.'history 43 WHERE summarized = \'true\' 44 ORDER BY id DESC 45 LIMIT 1 46 ;'; 47 // note : much faster than searching MAX(ID), ie on my big sample 14 seconds Vs 2 seconds 48 $history_lines = query2array($query); 49 if (count($history_lines) > 0) 50 { 51 $last_summarized = $history_lines[0]; 52 53 list($year, $month, $day) = explode('-', $last_summarized['date']); 54 list($hour) = explode(':', $last_summarized['time']); 55 56 single_update( 57 PREFIX_TABLE.'history_summary', 58 array( 59 'history_id_to' => $last_summarized['id'], 60 ), 61 array( 62 'year' => $year, 63 'month' => $month, 64 'day' => $day, 65 'hour' => $hour, 66 ) 67 ); 68 69 // in case this script would update no summary line, it would mean the 70 // summary has been purged and will be rebuild from scratch, based on the 71 // content of history table 72 } 73 */ <!-- github-comment-id:310922650 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#513