Add database indexes for Postgres

This commit is contained in:
Frederic Guillot 2016-12-27 21:12:19 -05:00
parent 9b4892e3ca
commit e4c4240317
3 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,10 @@ function get_connection()
$db = new PicoDb\Database(get_connection_parameters());
$db->getStatementHandler()->withLogging();
if (DEBUG_MODE) {
$db->getStatementHandler()->withStopWatch();
}
if ($db->schema('\Miniflux\Schema')->check(Schema\VERSION)) {
return $db;
} else {

View File

@ -2,6 +2,7 @@
namespace Miniflux\Helper;
use PicoDb\Database;
use PicoFeed\Logging\Logger;
function escape($value)
@ -62,6 +63,8 @@ function is_secure_connection()
function write_debug_file() {
if (DEBUG_MODE) {
file_put_contents(DEBUG_FILENAME, implode(PHP_EOL, Logger::getMessages()), FILE_APPEND|LOCK_EX);
$feed_logs = Logger::getMessages();
$db_logs = Database::getInstance('db')->getLogMessages();
file_put_contents(DEBUG_FILENAME, implode(PHP_EOL, array_merge($feed_logs, $db_logs)), FILE_APPEND|LOCK_EX);
}
}

View File

@ -130,4 +130,7 @@ function version_1(PDO $pdo)
$fever_token,
md5('admin:'.$fever_token),
));
$pdo->exec('CREATE INDEX items_user_status_idx ON items(user_id, status)');
$pdo->exec('CREATE INDEX items_user_feed_idx ON items(user_id, feed_id)');
}