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

Postgresql : Request optimization #60

Open
ikit opened this issue Mar 16, 2018 · 0 comments
Open

Postgresql : Request optimization #60

ikit opened this issue Mar 16, 2018 · 0 comments
Labels
help wanted Issue on which we need external help optimization Issue regarding performance and code optimization

Comments

@ikit
Copy link
Member

ikit commented Mar 16, 2018

The following query takes long time. Is it possible to optimize it ?

UPDATE wt_1 AS w SET is_exonic=True FROM refgene_exon_hg38 AS r WHERE w.chr=r.chr AND w.pos <@ r.exonrange

(venv) ➜  regovar git:(master) ✗ sql regovar "explain update wt_1 as w set is_exonic=True from refgene_exon_hg38 as r where w.chr=r.chr AND w.pos <@ r.exonrange" 
                                                        QUERY PLAN                                                        
--------------------------------------------------------------------------------------------------------------------------
 Update on wt_1 w  (cost=0.29..46206757.52 rows=23403374 width=1114)
   ->  Nested Loop  (cost=0.29..46206757.52 rows=23403374 width=1114)
         ->  Seq Scan on wt_1 w  (cost=0.00..57623.45 rows=681645 width=1108)
         ->  Index Scan using refgene_exon_hg38_exonange_idx on refgene_exon_hg38 r  (cost=0.29..66.33 rows=137 width=32)
               Index Cond: (w.pos <@ exonrange)
               Filter: (w.chr = chr)

refgene_exon_hg38 is the table with the list of all exons (658213 rows, with index on (chr, exonrange))

CREATE INDEX refgene_exon_hg38_chrom_exonange_idx
  ON refgene_exon_hg38
  USING btree (bin, chr, exonrange);
  
CREATE INDEX refgene_exon_hg38_exonange_idx
  ON refgene_exon_hg38
  USING gist (exonrange);

wt_1 is the working table created for an analysis (here the analysis with the id=1), with all variant s and their annotations

@ikit ikit added help wanted Issue on which we need external help optimization Issue regarding performance and code optimization labels Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue on which we need external help optimization Issue regarding performance and code optimization
Projects
None yet
Development

No branches or pull requests

1 participant