Attempt number 2 on a larger dataset; the people table.

Note: This has a previously applied optimization of using a local cache.

Before:
```
458570   66.934    0.000   66.934    0.000 {method 'execute' of 'sqlite3.Cursor' objects}
246771   58.075    0.000   58.075    0.000 {method 'fetchone' of 'sqlite3.Cursor' objects}
```

After:
```
368883   66.220    0.000   66.220    0.000 {method 'execute' of 'sqlite3.Cursor' objects}
157084   58.160    0.000   58.160    0.000 {method 'fetchone' of 'sqlite3.Cursor' objects}
```

Once again, the number of calls to execute and fetchone are reduced but
the total time spent executing each is relatively stable.
This commit is contained in:
Chuddah 2020-02-23 18:27:12 +00:00
parent 0a69894320
commit 6fe450da4d
2 changed files with 4 additions and 13 deletions

View File

@ -40,11 +40,6 @@ class Kodi(object):
return self.cursor.fetchone()[0] + 1
def create_entry_person(self):
self.cursor.execute(QU.create_person)
return self.cursor.fetchone()[0] + 1
def create_entry_genre(self):
self.cursor.execute(QU.create_genre)
@ -164,8 +159,8 @@ class Kodi(object):
def add_person(self, *args):
person_id = self.create_entry_person()
self.cursor.execute(QU.add_person, (person_id,) + args)
self.cursor.execute(QU.add_person, args)
return self.cursor.lastrowid
return person_id

View File

@ -12,10 +12,6 @@ create_file = """
SELECT coalesce(max(idFile), 0)
FROM files
"""
create_person = """
SELECT coalesce(max(actor_id), 0)
FROM actor
"""
create_genre = """
SELECT coalesce(max(genre_id), 0)
FROM genre
@ -225,8 +221,8 @@ VALUES (?, ?, ?)
"""
add_file_obj = ["{PathId}", "{Filename}"]
add_person = """
INSERT INTO actor(actor_id, name)
VALUES (?, ?)
INSERT INTO actor(name)
VALUES (?)
"""
add_people_movie_obj = ["{People}", "{MovieId}", "movie"]
add_people_mvideo_obj = ["{People}", "{MvideoId}", "musicvideo"]