RFE #1548637, option to not display record counts for views
This commit is contained in:
@@ -8,6 +8,9 @@ $HeadURL$
|
|||||||
2006-12-31 Marc Delisle <lem9@users.sourceforge.net>
|
2006-12-31 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* Documentation.html: RFE #1602243, another cause for Missing parameter,
|
* Documentation.html: RFE #1602243, another cause for Missing parameter,
|
||||||
thanks to Dave Nolan
|
thanks to Dave Nolan
|
||||||
|
* Documentation.html, db_structure.php, libraries/Table.class.php,
|
||||||
|
/config.default.php: RFE #1548637, MaxExactCountViews (default 0)
|
||||||
|
so by default, row count is not done for views
|
||||||
|
|
||||||
2006-12-30 Marc Delisle <lem9@users.sourceforge.net>
|
2006-12-30 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/Config.class.php: bug #1590083,
|
* libraries/Config.class.php: bug #1590083,
|
||||||
|
@@ -1754,16 +1754,18 @@ $cfg['TrustedProxies'] =
|
|||||||
<dd>Enable <a href="#transformations">MIME-transformations</a>.</dd>
|
<dd>Enable <a href="#transformations">MIME-transformations</a>.</dd>
|
||||||
|
|
||||||
<dt id="cfg_MaxExactCount">$cfg['MaxExactCount'] integer</dt>
|
<dt id="cfg_MaxExactCount">$cfg['MaxExactCount'] integer</dt>
|
||||||
<dd><ul><li>For InnoDB tables, determines for how large tables phpMyAdmin
|
<dd>For InnoDB tables, determines for how large tables phpMyAdmin
|
||||||
should get the exact row count using <code>SELECT COUNT</code>.
|
should get the exact row count using <code>SELECT COUNT</code>.
|
||||||
If the approximate row count as returned by
|
If the approximate row count as returned by
|
||||||
<code>SHOW TABLE STATUS</code> is smaller than this value,
|
<code>SHOW TABLE STATUS</code> is smaller than this value,
|
||||||
<code>SELECT COUNT</code> will be used, otherwise the approximate
|
<code>SELECT COUNT</code> will be used, otherwise the approximate
|
||||||
count will be used.</li>
|
count will be used.
|
||||||
<li>For VIEWs, since obtaining the exact count could have an
|
</dd>
|
||||||
impact on performance, this value is the maximum to be displayed.
|
<dt id="cfg_MaxExactCountViews">$cfg['MaxExactCountViews'] integer</dt>
|
||||||
</li>
|
<dd>For VIEWs, since obtaining the exact count could have an
|
||||||
</ul>
|
impact on performance, this value is the maximum to be displayed, using
|
||||||
|
a <code>SELECT COUNT ... LIMIT</code>. The default value of 0 bypasses
|
||||||
|
any row counting.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt id="wysiwyg">
|
<dt id="wysiwyg">
|
||||||
|
@@ -348,7 +348,7 @@ foreach ($tables as $keyname => $each_table) {
|
|||||||
// that needs to be repaired
|
// that needs to be repaired
|
||||||
|
|
||||||
if (isset($each_table['TABLE_ROWS']) && ($each_table['ENGINE'] != null || $table_is_view)) {
|
if (isset($each_table['TABLE_ROWS']) && ($each_table['ENGINE'] != null || $table_is_view)) {
|
||||||
if ($table_is_view && $each_table['TABLE_ROWS'] >= $cfg['MaxExactCount']) {
|
if ($table_is_view && $each_table['TABLE_ROWS'] >= $cfg['MaxExactCountViews']) {
|
||||||
$at_least_one_view_exceeds_max_count = true;
|
$at_least_one_view_exceeds_max_count = true;
|
||||||
$show_superscript = '<sup>1</sup>';
|
$show_superscript = '<sup>1</sup>';
|
||||||
} else {
|
} else {
|
||||||
@@ -489,7 +489,7 @@ echo ' <option value="' . $strAnalyzeTable . '" >'
|
|||||||
|
|
||||||
if ($at_least_one_view_exceeds_max_count && !$db_is_information_schema) {
|
if ($at_least_one_view_exceeds_max_count && !$db_is_information_schema) {
|
||||||
echo '<div class="notice">' . "\n";
|
echo '<div class="notice">' . "\n";
|
||||||
echo '<sup>1</sup>' . PMA_sanitize(sprintf($strViewMaxExactCount, PMA_formatNumber($cfg['MaxExactCount'], 0), '[a@./Documentation.html#cfg_MaxExactCount@_blank]', '[/a]')) . "\n";
|
echo '<sup>1</sup>' . PMA_sanitize(sprintf($strViewMaxExactCount, PMA_formatNumber($cfg['MaxExactCountViews'], 0), '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]')) . "\n";
|
||||||
echo '</div>' . "\n";
|
echo '</div>' . "\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -370,19 +370,29 @@ class PMA_Table {
|
|||||||
|
|
||||||
$tbl_is_view = PMA_Table::isView($db, $table);
|
$tbl_is_view = PMA_Table::isView($db, $table);
|
||||||
|
|
||||||
|
// for a VIEW, $row_count is always false at this point
|
||||||
if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
|
if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
|
||||||
if (! $tbl_is_view) {
|
if (! $tbl_is_view) {
|
||||||
$row_count = PMA_DBI_fetch_value(
|
$row_count = PMA_DBI_fetch_value(
|
||||||
'SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.'
|
'SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.'
|
||||||
. PMA_backquote($table));
|
. PMA_backquote($table));
|
||||||
// since counting all rows of a view could be too long
|
|
||||||
} else {
|
} else {
|
||||||
// try_query because it can fail ( a VIEW was based on
|
// For complex views, even trying to get a partial record
|
||||||
|
// count could bring down a server, so we offer an
|
||||||
|
// alternative: setting MaxExactCountViews to 0 will bypass
|
||||||
|
// completely the record counting for views
|
||||||
|
|
||||||
|
if ($GLOBALS['cfg']['MaxExactCountViews'] == 0) {
|
||||||
|
$row_count = 0;
|
||||||
|
} else {
|
||||||
|
// Counting all rows of a VIEW could be too long, so use
|
||||||
|
// a LIMIT clause.
|
||||||
|
// Use try_query because it can fail ( a VIEW is based on
|
||||||
// a table that no longer exists)
|
// a table that no longer exists)
|
||||||
$result = PMA_DBI_try_query(
|
$result = PMA_DBI_try_query(
|
||||||
'SELECT 1 FROM ' . PMA_backquote($db) . '.'
|
'SELECT 1 FROM ' . PMA_backquote($db) . '.'
|
||||||
. PMA_backquote($table) . ' LIMIT '
|
. PMA_backquote($table) . ' LIMIT '
|
||||||
. $GLOBALS['cfg']['MaxExactCount'],
|
. $GLOBALS['cfg']['MaxExactCountViews'],
|
||||||
null, PMA_DBI_QUERY_STORE);
|
null, PMA_DBI_QUERY_STORE);
|
||||||
if (!PMA_DBI_getError()) {
|
if (!PMA_DBI_getError()) {
|
||||||
$row_count = PMA_DBI_num_rows($result);
|
$row_count = PMA_DBI_num_rows($result);
|
||||||
@@ -390,6 +400,7 @@ class PMA_Table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
return $row_count;
|
return $row_count;
|
||||||
|
@@ -531,8 +531,8 @@ $cfg['QueryWindowDefTab'] = 'sql'; // which tab to display in the query
|
|||||||
$cfg['QueryHistoryMax'] = 25; // When using DB-based query history, how many entries
|
$cfg['QueryHistoryMax'] = 25; // When using DB-based query history, how many entries
|
||||||
// should be kept?
|
// should be kept?
|
||||||
$cfg['BrowseMIME'] = TRUE; // Use MIME-Types (stored in column comments table) for
|
$cfg['BrowseMIME'] = TRUE; // Use MIME-Types (stored in column comments table) for
|
||||||
$cfg['MaxExactCount'] = 20000; // When approximate count < this, PMA will get exact count for
|
$cfg['MaxExactCount'] = 20000; // When approximate count < this, PMA will get exact count for table rows.
|
||||||
// table rows.
|
$cfg['MaxExactCountViews'] = 0; // Zero means that no row count is done for views; see the doc
|
||||||
$cfg['WYSIWYG-PDF'] = TRUE; // Utilize DHTML/JS capabilities to allow WYSIWYG editing of
|
$cfg['WYSIWYG-PDF'] = TRUE; // Utilize DHTML/JS capabilities to allow WYSIWYG editing of
|
||||||
// the PDF page editor. Requires an IE6/Mozilla based browser.
|
// the PDF page editor. Requires an IE6/Mozilla based browser.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user