diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index a11e2e337..d3e691b3c 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -1,6 +1,8 @@ drop table ttrss_tags; + drop table ttrss_user_entries; drop table ttrss_entries; + drop table ttrss_feeds; drop table ttrss_labels; drop table ttrss_filters; @@ -27,6 +29,8 @@ create table ttrss_feeds (id serial not null primary key, last_error text not null default '', site_url varchar(250) not null default ''); +create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid); + insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed'); insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Latest Linux Kernel Versions','http://kernel.org/kdist/rss.xml'); insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'RPGDot Newsfeed', @@ -45,7 +49,8 @@ create table ttrss_entries (id serial not null primary key, content_hash varchar(250) not null, no_orig_date boolean not null default false, date_entered timestamp not null default NOW(), - comments varchar(250) not null default ''); + comments varchar(250) not null default '', + index (guid), index(title)); create table ttrss_user_entries ( ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE, @@ -55,6 +60,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_ref_id_index on ttrss_user_entries(ref_id); + drop table ttrss_filters; drop table ttrss_filter_types; @@ -80,6 +89,8 @@ create table ttrss_labels (id serial not null primary key, sql_exp varchar(250) not null, description varchar(250) not null); +create index ttrss_labels_owner_uid_index on ttrss_labels(owner_uid); + insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true', 'Unread articles'); @@ -91,6 +102,8 @@ create table ttrss_tags (id serial not null primary key, owner_uid integer not null references ttrss_users(id) on delete cascade, post_id integer references ttrss_entries(id) ON DELETE CASCADE not null); +create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid); + drop table ttrss_version; create table ttrss_version (schema_version int not null); @@ -149,4 +162,7 @@ create table ttrss_user_prefs ( pref_name varchar(250) not null references ttrss_prefs(pref_name), 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); +