Performance: Indizes für alle Suchfelder hinzugefügt

This commit is contained in:
2025-03-18 14:01:08 +01:00
parent d388bce528
commit 7c76e3aafc

18
app.py
View File

@@ -54,12 +54,18 @@ def init_db():
)
''')
# Erstelle Indizes für häufig durchsuchte Spalten
c.execute('CREATE INDEX IF NOT EXISTS idx_name ON customers(name)')
c.execute('CREATE INDEX IF NOT EXISTS idx_ort ON customers(ort)')
c.execute('CREATE INDEX IF NOT EXISTS idx_nummer ON customers(nummer)')
c.execute('CREATE INDEX IF NOT EXISTS idx_telefon ON customers(telefon)')
c.execute('CREATE INDEX IF NOT EXISTS idx_email ON customers(email)')
# Erstelle Indizes für alle Suchfelder
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_nummer ON customers(nummer)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_name ON customers(name)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_strasse ON customers(strasse)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_plz ON customers(plz)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_ort ON customers(ort)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_telefon ON customers(telefon)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_mobil ON customers(mobil)')
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_email ON customers(email)')
# Erstelle einen zusammengesetzten Index für die häufigste Suchkombination
c.execute('CREATE INDEX IF NOT EXISTS idx_customers_name_ort ON customers(name, ort)')
conn.commit()
conn.close()