Why does Google App Engine restrict GQL queries?

2019-06-22 16:12发布

I was reading about App Engine on wikipedia and came across some GQL restrictions:

  • JOIN is not supported

  • can SELECT from at most one table at a time

  • can put at most 1 column in the WHERE clause

What are the advantages of these restrictions?

Are these restrictions common in other places where scalability is a priority?

3条回答
Emotional °昔
2楼-- · 2019-06-22 16:27

I believe the answer is in fact to do with the underlying technology of the datastore rather than any kind of restriction on what is available. Google aren't using a relational database under the hood, but instead BigTable, they have just added a nice API which uses SQL like queries to limit the learning curve for those who are used to using a relational database. For those who are more used to using ORM's will take to it like a duck to water.

查看更多
对你真心纯属浪费
3楼-- · 2019-06-22 16:32

The datastore that GQL talks to is:

  • not a relational database like MySQL or PostgreSQL
  • is a Column-oriented DBMS called BigTable

One reason to have a database like this is to have a very high performance database that you can scale across hundreds of servers.

GQL is not SQL it is SQL-like.

Here are some references:

查看更多
相关推荐>>
4楼-- · 2019-06-22 16:33

the existing answers do a good job with the high-level question.

one additional note: the third restriction you mention isn't actually true. GQL queries can include as many columns in the WHERE clause as you like. there are a few caveats, but number of columns is not explicitly limited. more:

http://code.google.com/appengine/docs/python/datastore/queries.html

查看更多
登录 后发表回答