{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/896","repository_url":"https://api.github.com/repos/ParsePlatform/parse-server","labels_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/896/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/896/comments","events_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/896/events","html_url":"https://github.com/ParsePlatform/parse-server/issues/896","id":139065988,"number":896,"title":"Extra queries to _SCHEMA","user":{"login":"steven-supersolid","id":5364685,"avatar_url":"https://avatars.githubusercontent.com/u/5364685?v=3","gravatar_id":"","url":"https://api.github.com/users/steven-supersolid","html_url":"https://github.com/steven-supersolid","followers_url":"https://api.github.com/users/steven-supersolid/followers","following_url":"https://api.github.com/users/steven-supersolid/following{/other_user}","gists_url":"https://api.github.com/users/steven-supersolid/gists{/gist_id}","starred_url":"https://api.github.com/users/steven-supersolid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steven-supersolid/subscriptions","organizations_url":"https://api.github.com/users/steven-supersolid/orgs","repos_url":"https://api.github.com/users/steven-supersolid/repos","events_url":"https://api.github.com/users/steven-supersolid/events{/privacy}","received_events_url":"https://api.github.com/users/steven-supersolid/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ParsePlatform/parse-server/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-03-07T19:15:13Z","updated_at":"2016-09-18T01:05:19Z","closed_at":"2016-09-18T01:05:19Z","body":"I've tested running some simple operations using parse.com and using parse-server on Heroku, using the same Parse application and database on mLab. I enabled profiling level 2 and performed the following:\r\n\r\n**Query on _User**\r\nparse.com:\r\n`{ \"op\" : \"query\", \"ns\" : \"myapp._User\", \"query\" : { \"$query\" : { \"_id\" : \"1\" }...`\r\n\r\nparse-server:\r\n`{ \"op\" : \"query\", \"ns\" : \"myapp._SCHEMA\", \"query\" : {  }...`\r\n`{ \"op\" : \"query\", \"ns\" : \"myapp._User\", \"query\" : { \"$query\" : { \"_id\" : \"1\" }...`\r\n\r\nSo there is an extra query on _SCHEMA each time.\r\n\r\n**Save Inventory (custom class)**\r\nparse.com:\r\n`{ \"op\" : \"command\", \"ns\" : \"myapp.$cmd\", \"command\" : { \"findAndModify\" : \"Inventory\", \"query\" : { \"_id\" : \"rtWGOfh6bo\" }...`\r\n\r\nparse-server:\r\n`{ \"op\" : \"query\", \"ns\" : \"myapp._SCHEMA\", \"query\" : {  }...`\r\n`{ \"op\" : \"query\", \"ns\" : \"myapp._SCHEMA\", \"query\" : {  }...`\r\n`{ \"op\" : \"command\", \"ns\" : \"myapp.$cmd\", \"command\" : { \"findandmodify\" : \"Inventory\", \"query\" : { \"_id\" : \"i3fwQlIeeB\" }...`\r\n\r\nThis is querying _SCHEMA twice for each call.\r\n\r\nMy use case is to query Inventory, modify and then save so this actually performs a total of 3 _SCHEMA queries. During a previous test I also noticed additional queries to _Role but those were not present in this recent test, possibly due to a change in parse-server. Each query to _Role also incurred an additional query to _SCHEMA so I'll repeat the test.\r\n\r\nIf some of the additional queries to _SCHEMA could be avoided, particularly the double query on save then it may improve the max request/second. Even better would be to add an option to disable queries on _SCHEMA because my application code already knows what the schema is."},"comment":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/comments/247817421","html_url":"https://github.com/ParsePlatform/parse-server/issues/896#issuecomment-247817421","issue_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/896","id":247817421,"user":{"login":"flovilmart","id":364568,"avatar_url":"https://avatars.githubusercontent.com/u/364568?v=3","gravatar_id":"","url":"https://api.github.com/users/flovilmart","html_url":"https://github.com/flovilmart","followers_url":"https://api.github.com/users/flovilmart/followers","following_url":"https://api.github.com/users/flovilmart/following{/other_user}","gists_url":"https://api.github.com/users/flovilmart/gists{/gist_id}","starred_url":"https://api.github.com/users/flovilmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flovilmart/subscriptions","organizations_url":"https://api.github.com/users/flovilmart/orgs","repos_url":"https://api.github.com/users/flovilmart/repos","events_url":"https://api.github.com/users/flovilmart/events{/privacy}","received_events_url":"https://api.github.com/users/flovilmart/received_events","type":"User","site_admin":false},"created_at":"2016-09-18T01:05:19Z","updated_at":"2016-09-18T01:05:19Z","body":"We've added a schema cache a while ago, closing. Feel free to reopen if the issue persist."}}
{"actor":{"display_login":"flovilmart"}}