diff options
Diffstat (limited to 'scripts/fill.image_urls.py')
| -rw-r--r-- | scripts/fill.image_urls.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/fill.image_urls.py b/scripts/fill.image_urls.py index 79280b9..4f7c2ea 100644 --- a/scripts/fill.image_urls.py +++ b/scripts/fill.image_urls.py @@ -12,6 +12,13 @@ def get_num_images_in_db(): ps = db.prepare("SELECT COUNT(*) FROM image_urls") return int(ps()[0][0]) +def vacuum_and_analyze(): + print("cleaning db") + ps = db.prepare("VACUUM image_urls") + ps() + ps2 = db.prepare("ANALYZE image_urls") + ps2() + def add_url(url): try: print(url) @@ -83,3 +90,4 @@ if __name__ == "__main__": num_new_images = get_num_images_in_db() - num_existing_images percent_new_images = num_new_images / len(urls) * 100 print(num_new_images, " were new (", percent_new_images ,"%)") + vacuum_and_analyze() |
