Commit 123d0063 authored by Inkhey's avatar Inkhey

tmp table for performance

parent 2b684043
......@@ -393,30 +393,27 @@ class sqlGit(object):
from file f join date_file df
where f.dir=df.dir
and f.name=df.file;''')
#tmp table to gain time
c.execute('''
create table tmp as
select
a.author_name || a.author_mail as author,
f.dir || f.file as file
from link_file_commits f, link_author_commits a
where ( f.commits=a.commits);
''')
self.conn.commit()
c.execute('''
create table edges as
select f1.file AS source , f2.file AS target,
count(distinct(f1.author)) as nbAuthors,
count(distinct(f1.author)) as weight
from
(
(select
a.author_name || a.author_mail as author,
f.dir || f.file as file
from link_file_commits f, link_author_commits a
where ( f.commits=a.commits)
)as f1
join
(select
a.author_name || a.author_mail as author,
f.dir || f.file as file
from link_file_commits f, link_author_commits a
where ( f.commits=a.commits)
)as f2
on f1.author = f2.author
and f1.file != f2.file
tmp as f1
join
tmp as f2
on f1.author = f2.author
and f1.file != f2.file
)
group by f1.file , f2.file;''')
self.conn.commit()
......@@ -437,6 +434,15 @@ class sqlGit(object):
where a.email=da.email
and a.name=da.name;''')
c.execute('''
create table tmp as
select
a.author_name || a.author_mail as author,
f.dir || f.file as file
from link_file_commits f, link_author_commits a
where ( f.commits=a.commits);
''')
self.conn.commit()
c.execute('''
create table edges as
select a1.author AS source , a2.author AS target,
......@@ -445,19 +451,9 @@ class sqlGit(object):
a1.file as label
from
(
(select
a.author_name || a.author_mail as author,
f.dir || f.file as file
from link_file_commits f, link_author_commits a
where ( f.commits=a.commits)
)as a1
tmp as a1
join
(select
a.author_name || a.author_mail as author,
f.dir || f.file as file
from link_file_commits f, link_author_commits a
where ( f.commits=a.commits)
)as a2
tmp as a2
on a1.file = a2.file
and a1.author != a2.author
)
......@@ -507,7 +503,7 @@ class sqlGit(object):
''' drop current view'''
c = self.conn.cursor()
listTable = ('nodes', 'edges')
listTable = ('nodes', 'edges','tmp')
for table in listTable:
c.execute('DROP TABLE IF EXISTS ' + table + ' ;')
self.conn.commit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment