diff options
| author | Scott Ostler <scottbot9000@gmail.com> | 2010-10-24 22:07:37 -0400 |
|---|---|---|
| committer | Scott Ostler <scottbot9000@gmail.com> | 2010-10-24 22:07:37 -0400 |
| commit | f4bdb335fb3bdae6cd82315917ebacfb939b665a (patch) | |
| tree | 2c3a960e4d7b380b3f38fc6b3e8b1ffaff228cd1 /scripts/fill.image_urls.py | |
| parent | 33955c93ae8050778c75c18756585a59103ea86f (diff) | |
| parent | 8faf08aca6e0a251f13e7217487e6b18c463e02e (diff) | |
Merge branch 'master' of ssh://dump.fm/pichat/repo
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() |
