Parameters:
     - new_index
     - index_table
11927
def add_index(self, new_index, index_table):
    
    self.send_add_index(new_index, index_table)
    return self.recv_add_index()
550382
def create_index(self, columns, name=None, index_type="btree"):
        
        self._check_dropped()
        if not name:
            sig = "||".join(columns + [index_type])
            # This is a work-around for a bug in <=0.6.1 which would create
            # indexes based on hash() rather than a proper hash.
            key = abs(hash(sig))
            name = "ix_%s_%s" % (self.table.name, key)
            if name in self.indexes:
                return self.indexes[name]
            key = sha1(sig.encode("utf-8")).hexdigest()[:16]
            name = "ix_%s_%s" % (self.table.name, key)
        if name in self.indexes:
            return self.indexes[name]
        # self.db._acquire()
        columns = [self.table.c[col] for col in columns]
        idx = Index(name, *columns, postgresql_using=index_type)
        idx.create(self.engine)
        # finally:
        #    self.db._release()
        self.indexes[name] = idx
        return idx
696428
def _update_throughput(self, tablename, read, write, index):
        

        def get_desc():
            """ Get the table or global index description """
            desc = self.describe(tablename, refresh=True, require=True)
            if index is not None:
                return desc.global_indexes[index]
            return desc

        desc = get_desc()

        def num_or_star(value):
            """ Convert * to 0, otherwise resolve a number """
            return 0 if value == "*" else resolve(value)

        read = num_or_star(read)
        write = num_or_star(write)
        if read <= 0:
            read = desc.read_throughput
        if write <= 0:
            write = desc.write_throughput

        throughput = Throughput(read, write)
        kwargs = {}
        if index:
            kwargs["global_indexes"] = {index: throughput}
        else:
            kwargs["throughput"] = throughput
        self.connection.update_table(tablename, **kwargs)
        desc = get_desc()
        while desc.status == "UPDATING":  # pragma: no cover
            time.sleep(5)
            desc = get_desc()
542981
private void createIndexOnTable(TableInfo tableInfo)
    {

        List<IndexInfo> indexColumns = tableInfo.getColumnsToBeIndexed();
        for (IndexInfo indexInfo : indexColumns)
        {
            if (indexInfo.getIndexType() != null && indexInfo.getIndexType().toLowerCase().equals(Constants.COMPOSITE))
            {
                String[] columnNames = indexInfo.getColumnName().split(Constants.COMMA);
                createIndex(tableInfo.getTableName(), indexInfo.getIndexName(), columnNames);
            }
            else
            {
                createIndex(tableInfo.getTableName(), indexInfo.getIndexName(), indexInfo.getColumnName());
            }
        }
    }
1281214
def indexes(table_name, name = nil)#:nodoc:
      indexes = []
      current_index = nil
      show_keys_from(table_name, name).each do |row|
        if current_index != row['Key_name']
          next if row['Key_name'] == "PRIMARY" # skip the primary key
          current_index = row['Key_name']
          indexes << ActiveRecord::ConnectionAdapters::IndexDefinition \
            .new(row['Table'], row['Key_name'], row['Non_unique'] == "0", [], row['Index_type'] == "SPATIAL")
        end
        indexes.last.columns << row['Column_name']
      end
      indexes
    end
1123257
public static function create_index($table, $index_columns, $index_name = '', $index = '', $db = null)
	{
		static $accepted_index = array('UNIQUE', 'FULLTEXT', 'SPATIAL', 'NONCLUSTERED', 'PRIMARY');

		// make sure the index type is uppercase
		$index !== '' and $index = strtoupper($index);

		if (empty($index_name))
		{
			if (is_array($index_columns))
			{
				foreach ($index_columns as $key => $value)
				{
					if (is_numeric($key))
					{
						$index_name .= ($index_name == '' ? '' : '_').$value;
					}
					else
					{
						$index_name .= ($index_name == '' ? '' : '_').str_replace(array('(', ')', ' '), '', $key);
					}
				}
			}
			else
			{
				$index_name = $index_columns;
			}
		}

		if ($index == 'PRIMARY')
		{
			$sql = 'ALTER TABLE ';
			$sql .= \DB::quote_identifier(\DB::table_prefix($table, $db ? $db : static::$connection), $db ? $db : static::$connection);
			$sql .= ' ADD PRIMARY KEY ';
			if (is_array($index_columns))
			{
				$columns = '';
				foreach ($index_columns as $key => $value)
				{
					if (is_numeric($key))
					{
						$columns .= ($columns=='' ? '' : ', ').\DB::quote_identifier($value, $db ? $db : static::$connection);
					}
					else
					{
						$columns .= ($columns=='' ? '' : ', ').\DB::quote_identifier($key, $db ? $db : static::$connection).' '.strtoupper($value);
					}
				}
				$sql .= ' ('.$columns.')';
			}
		}
		else
		{
			$sql = 'CREATE ';

			$index !== '' and $sql .= (in_array($index, $accepted_index)) ? $index.' ' : '';

			$sql .= 'INDEX ';
			$sql .= \DB::quote_identifier($index_name, $db ? $db : static::$connection);
			$sql .= ' ON ';
			$sql .= \DB::quote_identifier(\DB::table_prefix($table, $db ? $db : static::$connection), $db ? $db : static::$connection);
			if (is_array($index_columns))
			{
				$columns = '';
				foreach ($index_columns as $key => $value)
				{
					if (is_numeric($key))
					{
						$columns .= ($columns=='' ? '' : ', ').\DB::quote_identifier($value, $db ? $db : static::$connection);
					}
					else
					{
						$columns .= ($columns=='' ? '' : ', ').\DB::quote_identifier($key, $db ? $db : static::$connection).' '.strtoupper($value);
					}
				}
				$sql .= ' ('.$columns.')';
			}
			else
			{
				$sql .= ' ('.\DB::quote_identifier($index_columns, $db ? $db : static::$connection).')';
			}
		}


		return \DB::query($sql, \DB::UPDATE)->execute($db ? $db : static::$connection);
	}
272166
def create_indexes(clas,pool_or_cursor):
    ""
    for index in clas.INDEXES:
      # note: these are specified as either 'field,field,field' or a runnable query. you can put any query you want in there
      query = index if 'create index' in index.lower() else 'create index on %s (%s)'%(clas.TABLE,index)
      commit_or_execute(pool_or_cursor,query)
376026
def _array_make_sure_table_exists(self, array_name, index, name_seq):
        
        t = self[array_name][index]
        for key in name_seq[:-1]:
            t = t[key]
        name = name_seq[-1]
        if name not in t:
            new_table = element_factory.create_table({})
            self.append_elements([element_factory.create_table_header_element((array_name,) + name_seq), new_table])
            return new_table
257244
public function createIndex($table, array $indexDef, $options = []) {
        $sql = 'create '.
            (self::val('type', $indexDef) === Db::INDEX_UNIQUE ? 'unique ' : '').
            'index '.
            (self::val(Db::OPTION_IGNORE, $options) ? 'if not exists ' : '').
            $this->buildIndexName($table, $indexDef).
            ' on '.
            $this->prefixTable($table).
            $this->bracketList($indexDef['columns'], '`');

        $this->queryDefine($sql);
    }
790768
def add_index(columns, index_name = nil)
      options = { name: index_name } if index_name
      migration.add_index(table_name, columns, options || {})
    end
15173
def addIndex(self, index):
        
        index.setSchema(self)
        self.__indexes[index.name()] = index
695280
public function transCreateIndex($table, $index, $schema)
    {
        $this->transInitTable($table);
        $this->schemaUpdateTransaction[$table]['newIndexes'][$index] = $schema;
    }
327861
protected function _updateIndexes ($table_name) {
		$this->_indexes[$table_name] = [];
		foreach ($this->query(sprintf('SHOW INDEX FROM %s;', $table_name), \PDO::FETCH_ASSOC) as $index) {
			$this->_indexes[$table_name][$index['Key_name']][] = [
				'table_name'		=> $table_name,
				'temporary'			=> null,
				'unique'			=> !filter_var($index['Non_unique'], \FILTER_VALIDATE_BOOLEAN),
				'if_not_exists'		=> null,
				'key_name'			=> $index['Key_name'],
				'column_name'		=> $index['Column_name'],
				'seq_in_index'		=> $index['Seq_in_index'],
				'collation'			=> $index['Collation'],
				'cardinality'		=> $index['Cardinality'],
				'comment'			=> $index['Comment'],
				'index_comment'		=> $index['Index_comment'],
				'order'				=> null,
				'index_type'		=> $index['Index_type'],
				'sub_part'			=> $index['Sub_part'],
				'raw_data'			=> $index,
			];
		}
	}
776142
def index(name)
      indices[name] = Index.new(name) unless indices.include?(name)
    end
823302
def create_index(self, columns, name=None, **kw):
        
        columns = [normalize_column_name(c) for c in ensure_tuple(columns)]
        with self.db.lock:
            if not self.exists:
                raise DatasetException("Table has not been created yet.")

            for column in columns:
                if not self.has_column(column):
                    return

            if not self.has_index(columns):
                self._threading_warn()
                name = name or index_name(self.name, columns)
                columns = [self.table.c[c] for c in columns]
                idx = Index(name, *columns, **kw)
                idx.create(self.db.executable)
132439
def _create_indices(self, table_name, indices):
        
        require_string(table_name, "table_name")
        require_iterable_of(indices, (tuple, list))
        for index_column_set in indices:
            self._create_index(table_name, index_column_set)
223490
def rename_index(self, *args):
        '''
        '''
        if len(args) == 1:
            new_indices = args[0]
            old_indices =force_list(self.indices.keys())
        else:
            old_indices, new_indices = args
            old_indices, single = convert_index_to_keys(self.indices, old_indices)
            if single:
                old_indices, new_indices = [old_indices], [new_indices]

        if len(new_indices) != len(old_indices):
            raise ValueError('Length of update indices (%s) does not match '
                             'existing indices (%s)' %
                             (len(new_indices), len(old_indices)))

        map(MI_check_index_name, new_indices)

        if len(new_indices) != len(set(new_indices)):
            raise ValueError('New indices names are not unique: %s' % (new_indices,))

        od_replace_key(self.indices, old_indices, new_indices, multi=True)