id: create_drop_collection_python.md

创建、删除集合

本页提供创建或删除集合的 Python 示例代码。

参考 示例程序 获取更详细的使用方式。

创建集合

  1. 准备创建集合所需参数:

    1. # Prepare collection parameters.
    2. >>> param = {'collection_name':'test01', 'dimension':256, 'index_file_size':1024, 'metric_type':MetricType.L2}
  2. 创建集合名为 test01,维度为 256,自动创建索引的数据文件大小为 1024 MB,距离度量方式为欧氏距离(L2)的集合:

    1. # Create a collection.
    2. >>> milvus.create_collection(param)

删除集合

  1. # Drop a collection.
  2. >>> milvus.drop_collection(collection_name='test01')

常见问题

创建集合时 index_file_size 如何设置能达到性能最优? {{fragments/faq_index_file_size_best_practice.md}}
建立集合后,index_file_sizemetric_type 还支持修改吗? {{fragments/faq_update_param_after_collection.md}}
Milvus 对集合和分区的总数有限制吗? {{fragments/faq_collection_partition_numbers.md}}
Milvus 支持的向量维度的最大值是多少? {{fragments/faq_max_vector_dimension.md}}