Commit ac885b90 authored by Romain Loth's avatar Romain Loth

dbdatapi: extract loop replaced by WHERE..IN (25 x faster)

parent 07eeea46
......@@ -585,8 +585,7 @@ class BipartiteExtractor:
# mlog("DEBUG", "MySQL extract scholar_array:", scholar_array)
# scholar_array = list(scholar_array.keys())[0:3]
# TODO loop could be after SELECT
for scholar_id in scholar_array:
sql3='''
SELECT
scholars_and_orgs.*,
......@@ -627,16 +626,17 @@ class BipartiteExtractor:
ON sch_kw.uid = scholars_and_orgs.luid
LEFT JOIN keywords
ON sch_kw.kwid = keywords.kwid
WHERE luid = %s
WHERE luid IN %s
GROUP BY luid ;
''' % scholar_id
''' % ('('+','.join(map(str, list(scholar_array.keys())))+')')
# debug
# mlog("DEBUG", "db.extract: sql3="+sql3)
mlog("DEBUG", "db.extract: sql3="+sql3)
try:
self.cursor.execute(sql3)
res3=self.cursor.fetchone()
for res3 in self.cursor:
info = {};
# semantic short ID
......@@ -706,7 +706,6 @@ class BipartiteExtractor:
mlog("ERROR", "===== /extract ERROR ====")
# génère le gexf
# include('gexf_generator.php');
imsize=80;
......
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