Задать вопрос

Тел: +7 965 3737 888

436

Просмотров

1

Ответов

SQLite database vacuum script

This script can be run periodically (e.g. as a nightly cronjob) to keep a SQLite database with high churn from growing unnecessarily large.

Вопрос полезен? Да0/Нет0
file_3497.py(507.0б)
None

Ответы (1):

Ответdariosky:21.01.2011
Ответ полезен? Да0/Нет0

An update to make it work with multiple connection in Django 1.2:

from django.db import transaction, connections

def vacuum_db(using='default'):
    cursor = connections[using].cursor()
    cursor.execute("VACUUM")
    transaction.set_dirty(using=using)