none
Azure storage table query slow

    Question

  • Hi,

    I'm trying to run a filtered query against the WADLogsTable in Azure using powershell, but despite how much I try and filter it, it's incredibly slow when retrieving the data. The code I'm using is:

    $now = "0" + (Get-Date).ToUniversalTime().ticks
    $yesterday = "0" + (Get-Date).ToUniversalTime().AddMinutes(-1).ticks

    $table = Get-AzureStorageTable -Name "WADLogsTable" -Context $objStorageContext

    $query = New-Object "Microsoft.WindowsAzure.Storage.Table.TableQuery"

    $list = New-Object System.Collections.Generic.List[string]
    $list.Add("PreciseTimeStamp")
    $list.Add("Role")
    $list.Add("RoleInstance")
    $list.Add("Level")
    $list.Add("Eventid")
    $list.Add("Message")

    $query.FilterString = "Partitionkey gt '$yesterday' and Partitionkey le '$now'"
    $query.SelectColumns = $list

    $Datas = $Table.CloudTable.ExecuteQuery($query)
                          
    $ExportObjs = @()
                            
    Foreach($Data in $Datas)
    {   
        $Data

        $Obj = New-Object PSObject
     
        $Obj | Add-Member -Name PartitionKey -Value $Data.PartitionKey -MemberType NoteProperty
        $Obj | Add-Member -Name RowKey -Value $Data.RowKey -MemberType NoteProperty 
     
        $Data.Properties.Keys | Foreach{$Value = $data.Properties[$_].PropertyAsObject;
        $Obj | Add-Member -Name $_ -Value $value -MemberType NoteProperty; }
     
        $ExportObjs += $Obj

     
    $ExportObjs | select PreciseTimeStamp, Role, RoleInstance, Level, Eventid, Message

    I'm wondering if there's something wrong with the code or if the table simply needs to be cleaned out. I appreciate any assistance anyone's able to give me.

    Sunday, January 29, 2017 11:49 PM

All replies