Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update django and improve main page performance. #19

Merged
merged 7 commits into from
Feb 20, 2017

Conversation

degasus
Copy link
Member

@degasus degasus commented Jan 5, 2017

The first 4 commits are to replace deprecated django functions and to update django to its newest stable release.

The last 3 commits optimize the database usage to speed up the main page. It requires a few SQL commands for migration, they are in those commit messages.

The old one was dropped in django 1.10.
As selecting the list of types is slow in the current way, it's best to move the
name of the types into a small lookup table.

for migration:

create table fifoci_type (id serial primary key, type character varying(64) not null unique);
insert into fifoci_type (type) select distinct type from fifoci_result;
alter table fifoci_result add type_id integer references fifoci_type;
update fifoci_result r set type_id = (select id from fifoci_type where type = r.type);
alter table fifoci_result alter type_id SET NOT NULL;
create index on fifoci_result(type_id);
alter table fifoci_result drop type;
This can be improved further with the index:

create index on fifoci_result (ver_id) where (has_change or first_result);
We never want to do a full scan over the results table. So those indices
are never used and are just a bad hint for postgresql to do bitmap scaning.

drop index fifoci_result_first_result;
drop index fifoci_result_has_change;
@Tilka
Copy link
Member

Tilka commented Jan 5, 2017

As mentioned on IRC, I would like you to introduce migrations first, then do the model changes. Otherwise great PR. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants