def pg_multicolumn_index(model, column_names, cursor=None):
    """CREATE INDEX db_sample_prod_lab ON db_sample (status_code, production)"""
    cursor = cursor or con.cursor()
    # Get table name and column name as stored in database.
    db_table = model._meta.db_table
    db_column_names = [model._meta.get_field(column_name).column for column_name in column_names]
    db_index = "%s-%s"%(db_table, '_'.join(db_column_names))
    # Create the index.
    cursor.execute(
        "CREATE INDEX \"" + db_index + "\"" +
        " ON \"" + db_table + "\" (%s);"%(','.join(db_column_names)))
    cursor.execute("COMMIT;")
dataset/ETHPy150Open jfalkner/Efficient-Django-QuerySet-Use/demo-optimized/django_pg_utils/__init__.py/pg_multicolumn_index/original