{"action":"created","issue":{"url":"https://api.github.com/repos/robconery/massive-js/issues/43","labels_url":"https://api.github.com/repos/robconery/massive-js/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/robconery/massive-js/issues/43/comments","events_url":"https://api.github.com/repos/robconery/massive-js/issues/43/events","html_url":"https://github.com/robconery/massive-js/issues/43","id":64680608,"number":43,"title":"Connection incredibly slow ","user":{"login":"vintagexav","id":469244,"avatar_url":"https://avatars.githubusercontent.com/u/469244?v=3","gravatar_id":"","url":"https://api.github.com/users/vintagexav","html_url":"https://github.com/vintagexav","followers_url":"https://api.github.com/users/vintagexav/followers","following_url":"https://api.github.com/users/vintagexav/following{/other_user}","gists_url":"https://api.github.com/users/vintagexav/gists{/gist_id}","starred_url":"https://api.github.com/users/vintagexav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vintagexav/subscriptions","organizations_url":"https://api.github.com/users/vintagexav/orgs","repos_url":"https://api.github.com/users/vintagexav/repos","events_url":"https://api.github.com/users/vintagexav/events{/privacy}","received_events_url":"https://api.github.com/users/vintagexav/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-03-27T03:04:35Z","updated_at":"2015-03-28T16:45:11Z","closed_at":null,"body":"For a <100MB db, with <100 tables and approx. 1000 stored procedures (procedures are mostly coming from postgis, geometry, and other default functions, only 7% of the procedures are custom):\r\n\r\nloadTables: average `750ms`\r\nloadFunctions: average `15000ms`\r\n\r\nConnection string used: `postgres://user:pass@host:port/database?ssl=true`\r\n\r\nmassive.connect is being called before each request, passing that string as connection string. \r\nTherefore, `massive.loadTables` (`index.js`) is being called every time as well as `massive.loadFunctions`\r\n\r\nThis is performed from localhost, measured with `console.time` and `console.timeEnd`, and using pg.connect is almost instantaneous. \r\nAm I missing something? \r\n\r\nExtensions being used:\r\n`postgis_topology, postgis, plv8, plpgsql, topology, fuzzystrmatch`\r\n"},"comment":{"url":"https://api.github.com/repos/robconery/massive-js/issues/comments/87263372","html_url":"https://github.com/robconery/massive-js/issues/43#issuecomment-87263372","issue_url":"https://api.github.com/repos/robconery/massive-js/issues/43","id":87263372,"user":{"login":"vintagexav","id":469244,"avatar_url":"https://avatars.githubusercontent.com/u/469244?v=3","gravatar_id":"","url":"https://api.github.com/users/vintagexav","html_url":"https://github.com/vintagexav","followers_url":"https://api.github.com/users/vintagexav/followers","following_url":"https://api.github.com/users/vintagexav/following{/other_user}","gists_url":"https://api.github.com/users/vintagexav/gists{/gist_id}","starred_url":"https://api.github.com/users/vintagexav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vintagexav/subscriptions","organizations_url":"https://api.github.com/users/vintagexav/orgs","repos_url":"https://api.github.com/users/vintagexav/repos","events_url":"https://api.github.com/users/vintagexav/events{/privacy}","received_events_url":"https://api.github.com/users/vintagexav/received_events","type":"User","site_admin":false},"created_at":"2015-03-28T16:45:11Z","updated_at":"2015-03-28T16:45:11Z","body":"`app.set('db',db_instance)` and `eq.app.get('db')` seems the most straightforward - definitely worth to go in the README. \r\n\r\nHowever:\r\n\r\n- 10-20 seconds to init the db is a lot of downtime every time the app is rolled out. \r\n- Perfs are still just so bad. a `SELECT FROM WHERE id = 1` on a table with approx. 1k rows is <100ms using node's `pg.js` `connect` and `query` functions whereas it sums up above 500ms for Massive (and I am rounding in favor of Massive)\r\n\r\nFYI (@xivSolutions) all my tests here and above are performed over network, not localhost. "}}