views:

61

answers:

1

I've been getting really uneven results trying to request a numerically sorted list of records from Amazon SimpleDB.

I am zero padding my numbers to get them selected lexigraphically, but still no luck. These two queries are giving the same result, for example:

select * from cbcallers where calls_completed is not null order by calls_completed desc

select * from cbcallers where calls_completed is not null order by calls_completed asc

However, I am getting the correct results using Amazon's query language:

['calls_completed'starts-with ''] sort 'calls_completed' desc

And last week, I was getting different (unordered) results from this query on the same dataset. Anyone have any idea what's up? Is my query jacked?

The dataset looks like this:

Sdb-Item-Name, calls_completed, name, icon
8uda23sd7, 0000002, john smith, /myimgicon.jpg
8uda5asd3, 0000015, john smarts, /myimgicon2.jpg
8udassad8, 0000550, john smoogie, /myimgicon3.jpg
A: 

Your query looks completely correct. I loaded your data and used your queries verbatim and got just what you would expect.

Ascending:

select * from cbcallers where calls_completed is not null order by calls_completed asc
[
Item  8uda23sd7
  icon: myimgicon.jpg
  name: john smith
  calls_completed: 0000002, 
Item  8uda5asd3
  icon: myimgicon2.jpg
  name: john smarts
  calls_completed: 0000015, 
Item  8udassad8
  icon: myimgicon3.jpg
  name: john smoogie
  calls_completed: 0000550]

Descending:

select * from cbcallers where calls_completed is not null order by calls_completed desc
[
Item  8udassad8
  icon: myimgicon3.jpg
  name: john smoogie
  calls_completed: 0000550, 
Item  8uda5asd3
  icon: myimgicon2.jpg
  name: john smarts
  calls_completed: 0000015, 
Item  8uda23sd7
  icon: myimgicon.jpg
  name: john smith
  calls_completed: 0000002]

Maybe it is an issue with your SimpleDB client, which one are you using, do you know if it is using the latest SimpleDB API version ("2009-04-15")?

Mocky
Hm. That's interesting. I've actually been getting different results from my client (SDB Explorer) and from my scripting environment (which uses a PHP library http://sourceforge.net/projects/php-sdb/) ... hmm... i don't see a date on it... i'll have to dig around. Thanks for the tip.