Projet

Général

Profil

0001-sql-add-an-index-on-formdata-id-column-34174.patch

Frédéric Péters, 19 juin 2019 16:42

Télécharger (1,69 ko)

Voir les différences:

Subject: [PATCH] sql: add an index on formdata id column (#34174)

 wcs/sql.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
wcs/sql.py
531 531
    if concurrently:
532 532
        create_index = 'CREATE INDEX CONCURRENTLY'
533 533

  
534
    if not table_name + '_id' in existing_indexes:
535
        cur.execute('''%s %s_id ON %s (id)''' % (create_index, table_name, table_name))
536

  
534 537
    if not evolutions_table_name + '_fid' in existing_indexes:
535 538
        cur.execute('''%s %s_fid ON %s (formdata_id)''' % (
536 539
            create_index, evolutions_table_name, evolutions_table_name))
......
2190 2193
    return result
2191 2194

  
2192 2195

  
2193
SQL_LEVEL = 32
2196
SQL_LEVEL = 33
2194 2197

  
2195 2198
def migrate_global_views(conn, cur):
2196 2199
    cur.execute('''SELECT COUNT(*) FROM information_schema.tables
......
2302 2305
        # 29: add evolution parts to full-text index
2303 2306
        # 31: add user_label to formdata
2304 2307
        set_reindex('formdata', 'needed', conn=conn, cur=cur)
2305
    if sql_level < 24:
2308
    if sql_level < 33:
2306 2309
        from wcs.formdef import FormDef
2307 2310
        # 24: add index on evolution(formdata_id)
2311
        # 33: add index on form(id)
2308 2312
        for formdef in FormDef.select():
2309 2313
            do_formdef_indexes(formdef, created=False, conn=conn, cur=cur)
2310 2314
    if sql_level < 32:
2311
-