diff --git a/app.py b/app.py index 471228d..b09ddca 100644 --- a/app.py +++ b/app.py @@ -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()