日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

文檔

全匹配查詢(xún)

MatchAllQuery可以匹配所有行,常用于查詢(xún)表中數(shù)據(jù)總行數(shù),或者隨機(jī)返回幾條數(shù)據(jù)。

前提條件

參數(shù)

參數(shù)

說(shuō)明

TableName

數(shù)據(jù)表名稱(chēng)。

IndexName

多元索引名稱(chēng)。

Query

設(shè)置查詢(xún)類(lèi)型為MatchAllQuery。

Limit

本次查詢(xún)需要返回的最大數(shù)量。

如果只為了獲取行數(shù),無(wú)需獲取具體數(shù)據(jù),可以設(shè)置Limit=0,即不返回任意一行數(shù)據(jù)。

GetTotalCount

是否返回匹配的總行數(shù),默認(rèn)為false,表示不返回。

返回匹配的總行數(shù)會(huì)影響查詢(xún)性能。

ColumnsToGet

是否返回所有列。

ReturnAll默認(rèn)為false,表示不返回所有列,此時(shí)可以通過(guò)Columns指定返回的列;如果未通過(guò)Columns指定返回的列,則只返回主鍵列。

當(dāng)設(shè)置ReturnAll為true時(shí),表示返回所有列。

示例

以下示例用于查詢(xún)表中數(shù)據(jù)的總行數(shù)。

/**
 * 通過(guò)MatchAllQuery查詢(xún)表中數(shù)據(jù)的總行數(shù)。
 */
func MatchAllQuery(client *tablestore.TableStoreClient, tableName string, indexName string) {
    searchRequest := &tablestore.SearchRequest{}
    searchRequest.SetTableName(tableName)
    searchRequest.SetIndexName(indexName)
    query := &search.MatchAllQuery{} //設(shè)置查詢(xún)類(lèi)型為MatchAllQuery。
    searchQuery := search.NewSearchQuery()
    searchQuery.SetQuery(query) 
    searchQuery.SetGetTotalCount(true) 
    searchQuery.SetLimit(0) //設(shè)置Limit為0,表示不獲取具體數(shù)據(jù)。
    searchRequest.SetSearchQuery(searchQuery)
    searchResponse, err := client.Search(searchRequest)
    if err != nil { //判斷異常。
        fmt.Printf("%#v", err) 
        return
    }
    fmt.Println("IsAllSuccess: ", searchResponse.IsAllSuccess)
    fmt.Println("TotalCount: ", searchResponse.TotalCount) //打印總行數(shù)。
}

常見(jiàn)問(wèn)題

如何查看表的總行數(shù)

相關(guān)文檔

相關(guān)文檔