query optimisations for notifications - use a specific index only

This commit is contained in:
Mario Vavti
2018-01-28 12:09:47 +01:00
parent 423274b923
commit a86b260f73
5 changed files with 23 additions and 7 deletions

View File

@@ -321,6 +321,10 @@ function db_concat($fld, $sep) {
return \DBA::$dba->concat($fld, $sep);
}
function db_use_index($str) {
return \DBA::$dba->use_index($str);
}
/**
* @brief Execute a SQL query with printf style args.
*

View File

@@ -111,6 +111,15 @@ class dba_pdo extends dba_driver {
}
}
function use_index($str) {
if($this->driver_dbtype === 'pgsql') {
return '';
}
else {
return 'USE INDEX( ' . $str . ')';
}
}
function quote_interval($txt) {
if($this->driver_dbtype === 'pgsql') {
return "'$txt'";