update_daemon work, remove unneeded indexes, query optimizations
This commit is contained in:
parent
ac92cb46be
commit
894ebcf5e9
12
backend.php
12
backend.php
|
@ -5,13 +5,13 @@
|
|||
header("Pragma: no-cache");
|
||||
header("Expires: -1");
|
||||
|
||||
if ($_GET["debug"]) {
|
||||
/* if ($_GET["debug"]) {
|
||||
define('DEFAULT_ERROR_LEVEL', E_ALL);
|
||||
} else {
|
||||
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
|
||||
}
|
||||
|
||||
error_reporting(DEFAULT_ERROR_LEVEL);
|
||||
error_reporting(DEFAULT_ERROR_LEVEL); */
|
||||
|
||||
$op = $_REQUEST["op"];
|
||||
|
||||
|
@ -1490,7 +1490,7 @@
|
|||
// $content_query_part = "";
|
||||
// }
|
||||
|
||||
$result = db_query($link, "SELECT
|
||||
$query = "SELECT
|
||||
ttrss_entries.id,ttrss_entries.title,
|
||||
SUBSTRING(updated,1,16) as updated,
|
||||
unread,feed_id,marked,link,last_read,
|
||||
|
@ -1507,7 +1507,11 @@
|
|||
$search_query_part
|
||||
$view_query_part
|
||||
$query_strategy_part ORDER BY $order_by
|
||||
$limit_query_part");
|
||||
$limit_query_part";
|
||||
|
||||
$result = db_query($link, $query);
|
||||
|
||||
if ($_GET["debug"]) print $query;
|
||||
|
||||
} else {
|
||||
// browsing by tag
|
||||
|
|
|
@ -472,6 +472,11 @@ function all_counters_callback() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!parent.frames["feeds-frame"]) {
|
||||
notify("[all_counters_callback] no parent feeds-frame");
|
||||
return;
|
||||
}
|
||||
|
||||
var reply = xmlhttp_rpc.responseXML.firstChild;
|
||||
var f_document = parent.frames["feeds-frame"].document;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?
|
||||
|
||||
if ($_GET["debug"]) {
|
||||
/* if ($_GET["debug"]) {
|
||||
define('DEFAULT_ERROR_LEVEL', E_ALL);
|
||||
} else {
|
||||
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
|
||||
}
|
||||
} */
|
||||
|
||||
require_once 'config.php';
|
||||
require_once 'db-prefs.php';
|
||||
|
@ -56,11 +56,7 @@
|
|||
|
||||
function global_purge_old_posts($link, $do_output = false, $limit = false) {
|
||||
|
||||
if (DB_TYPE == "mysql") {
|
||||
$random_qpart = "RAND()";
|
||||
} else {
|
||||
$random_qpart = "RANDOM()";
|
||||
}
|
||||
$random_qpart = sql_random_function();
|
||||
|
||||
if ($limit) {
|
||||
$limit_qpart = "LIMIT $limit";
|
||||
|
@ -1044,4 +1040,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
function sql_random_function() {
|
||||
if (DB_TYPE == "mysql") {
|
||||
return "RAND()";
|
||||
} else {
|
||||
return "RANDOM()";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -82,8 +82,8 @@ create table ttrss_entries (id serial not null primary key,
|
|||
author varchar(250) not null default '');
|
||||
|
||||
create index ttrss_entries_guid_index on ttrss_entries(guid);
|
||||
create index ttrss_entries_title_index on ttrss_entries(title);
|
||||
create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
|
||||
-- create index ttrss_entries_title_index on ttrss_entries(title);
|
||||
-- create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
|
||||
|
||||
create table ttrss_user_entries (
|
||||
int_id serial not null primary key,
|
||||
|
@ -94,9 +94,10 @@ create table ttrss_user_entries (
|
|||
last_read timestamp,
|
||||
unread boolean not null default true);
|
||||
|
||||
create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
|
||||
create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
|
||||
-- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
|
||||
-- create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
|
||||
create index ttrss_user_entries_ref_id_index on ttrss_user_entries(ref_id);
|
||||
create index ttrss_user_entries_feed_id on ttrss_user_entries(feed_id);
|
||||
|
||||
create table ttrss_entry_comments (id serial not null primary key,
|
||||
ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE,
|
||||
|
@ -105,7 +106,7 @@ create table ttrss_entry_comments (id serial not null primary key,
|
|||
date_entered timestamp not null);
|
||||
|
||||
create index ttrss_entry_comments_ref_id_index on ttrss_entry_comments(ref_id);
|
||||
create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
|
||||
-- create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
|
||||
|
||||
create table ttrss_filter_types (id integer not null primary key,
|
||||
name varchar(120) unique not null,
|
||||
|
@ -229,7 +230,7 @@ create table ttrss_user_prefs (
|
|||
value text not null);
|
||||
|
||||
create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid);
|
||||
create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
|
||||
-- create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
|
||||
|
||||
create table ttrss_scheduled_updates (id serial not null primary key,
|
||||
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
while (true) {
|
||||
|
||||
if (time() - $last_purge > PURGE_INTERVAL) {
|
||||
print "Purging old posts...\n";
|
||||
global_purge_old_posts($link, true);
|
||||
print "Purging old posts (random 30 feeds)...\n";
|
||||
global_purge_old_posts($link, true, 30);
|
||||
$last_purge = time();
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,11 @@
|
|||
|
||||
// Process all other feeds using last_updated and interval parameters
|
||||
|
||||
$random_qpart = sql_random_function();
|
||||
|
||||
$result = db_query($link, "SELECT feed_url,id,owner_uid,
|
||||
SUBSTRING(last_updated,1,19) AS last_updated,
|
||||
update_interval FROM ttrss_feeds ORDER BY last_updated DESC");
|
||||
update_interval FROM ttrss_feeds ORDER BY $random_qpart DESC");
|
||||
|
||||
$user_prefs_cache = array();
|
||||
|
||||
|
|
|
@ -361,7 +361,10 @@ function catchupPage() {
|
|||
function init() {
|
||||
if (arguments.callee.done) return;
|
||||
arguments.callee.done = true;
|
||||
|
||||
if (parent.frames["feeds-frame"]) {
|
||||
document.onkeydown = hotkey_handler;
|
||||
}
|
||||
|
||||
var hw = document.getElementById("headlinesList").scrollHeight;
|
||||
var pw = parent.document.getElementById("headlines").scrollHeight;
|
||||
|
|
Loading…
Reference in New Issue