Question

I am using PHP to retrieve all rows from partition(s). I am using the below method to get all rows

http://www.windowsazure.com/en-us/develop/php/how-to-guides/table-service/#RetEntitiesInPartition

Facing a unique issue: If i am using one partition result is returned, using more than one partition with OR Clause returns no results.

Seems like to me two issues:

  1. Partition with OR Condition and Filter on other column causing something turn mental.

  2. There is issue with the PHP SDK ( Version 2.0 )

Any help will be highly appreciated,

  1. Queries have a Partition column properly used. e,g if I am running this query ( 10 rows against two partitions)

    ( cid eq '18831') and ( (PartitionKey eq '2013100606') or (PartitionKey eq '2013100607') )
    

    There is no response when partitionkey have more than one values with OR Clause using PHP script. Using storage explorer application Seems like it take more than 5 seconds for 10 rows to pull from two partitions. ( All i have is 10 rows no other data in both partitions)

If I access only one Partition it returns the rows.

( cid eq '18831') and ( (PartitionKey eq '2013100607') )  // Works fine

There are 10 rows in each partition, if i access single partition value it works fine.

Also please note I am using expect100Continue and Nagle turned off.

      <servicePointManager expect100Continue="false" useNagleAlgorithm="false"/> 
    </settings> 
<connectionManagement> 
      <add address = "*" maxconnection = "48" /> 
    </connectionManagement>
Was it helpful?

Solution

Based on the blog post by Windows Azure Storage team - How to get most out of Windows Azure Tables (scroll down to Queries section in the post, point #4), queries involving OR are not optimized and would result in full table scan. You may be running into issues because of that.

You may want to change your query to avoid this situation. A few things you could try are:

((PartitionKey ge '2013100606') and (PartitionKey le '2013100607')) and (cid eq '18831')

(PartitionKey eq '2013100606' and cid eq '18831') or (PartitionKey eq '2013100607' and cid eq '18831')

See if doing any of these help. Instead of 2nd query, you could fire two separate queries in parallel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top