Exemplo n.º 1
0
        /// <summary>
        /// 单独在表上再创建一个索引表2
        /// </summary>
        public static void CreateGlobalIndex()
        {
            OTSClient otsClient = Config.GetClient();

            Console.WriteLine("Start create globalIndex...");

            IndexMeta indexMeta = new IndexMeta(IndexName2);

            indexMeta.PrimaryKey = new List <string>()
            {
                Col2
            };
            indexMeta.DefinedColumns = new List <string>()
            {
                Pk1
            };


            CapacityUnit             reservedThroughput = new CapacityUnit(0, 0);
            CreateGlobalIndexRequest request            = new CreateGlobalIndexRequest(TableName, indexMeta);

            otsClient.CreateGlobalIndex(request);

            Console.WriteLine("Global Index is created,tableName: " + TableName + ",IndexName:" + IndexName2);
        }