开发者

Is Amazon SimpleDB a good choice for my data?

I'm working on a database that stores user-created surveys. The database needs to store a unique ID for each survey. Using SQL, I'd just use a SERIAL column type so each row has an auto-incrementing numeric key.

SimpleDB seems to store everything as a string, meaning I would have to generate a unique key m开发者_C百科yself. Since this key will be part of the URL, I think a UUID is just too long. I want to be able to load a survey with something like:

foo.com/1a

Is there any way to have SimpleDB generate a unique row ID for each item you store? Thanks!


OK, so you're asking for opinions here.... I would choice any other storage mechanism over simpledb. For example, you could easily go with MongoDB as a document storage alternative to a relational DB and get more benefits than with SimpleDB.

As far as wanting a short unique URL, you can search and find a ruby implementation to turn an ID into a shorted ID. http://blog.kischuk.com/2008/06/23/create-tinyurl-like-urls-in-ruby/

That implementation will turn 1174229 into "7sH_" (according to the post. YMMV)

So, you'd have something like

class Survey
  include Mongoid::Document

  def to_param
    generate_url(self.id)
  end
end

in routes

resources :surverys, :path=>''

And that would create

http://yourapp/7sh_

Of course this technique can work for non-mongo installs.


SDB Explorer supports bulk upload from MYSQL to Amazon SimpleDB. You can upload your MYSQL data to Amazon SimpleDB using Upload feature. While upload SDB Explorer generates unique ID. Even you can choose you own MYSQL filed as a itemName() i.e. unique id for Amazon SimpleDB.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜