New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequelize performance updates on medium-sized dataset #611

Closed
cflynn07 opened this Issue May 11, 2013 · 19 comments

Comments

5 participants
@cflynn07

cflynn07 commented May 11, 2013

I'm running into some kind of bottleneck using sequelize for returning data-sets of about 5000 records.

SELECT * FROM `employees` WHERE `employees`.`clientUid`='44cc27a5-af8b-412f-855a-57c8205d86f5'

A simple retrieve operation that executes this query takes about 22 seconds on my local, fairly decently powerful machine. Executing the same query against the database using a regular mysql client takes about 0.03 seconds.

Could there be a bottleneck in instantiating javascript objects for each record?

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

Is there any way to have sequelize return raw object literals for data when dealing with very large return data sets?

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

sequelize.query(
    "SELECT * FROM `employees` WHERE ...", 
    null, 
    {raw: true}).done(function (err, rawEmployees) {

})

The easiest way would be to do the query yourself using sequelize.query, passing raw: true in the options object. That will give you the raw data, without building a DAO for each.

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

I'm considering raw queries, how I like to use the eager-loading of nested associations. Is this feature not possible without first building DAO objects?

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

Any chance .findAll() can be instructed to return raw objects?

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

Not as it is right now, no. Your best bet would be to use sequelize.getQueryInterface for now. I have created a small example:

var call = sequelize.define('Call', {

});
var phonenumber = sequelize.define('Phonenumber', {

})

call.belongsTo(phonenumber);

sequelize.getQueryInterface().select(
    call, 
    "Call",
    { include: [ { association: call.associations.Phonenumber, daoFactory: phonenumber, as: 'Phonenumber'} ]}, '
    { raw: true}).done(
function (err, callsWithPhonenumbers) {

})

As you can see, this is very ugly, I'm sorry :-(. But this is the best we can do for now.

It should be possible to change findAll to accept query options as well however, which would make for much cleaner code.

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

Turns out adding queryOptions to find and findAll was pretty straighforward, PR submitted :)

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

Implemented in #611

@janmeier janmeier closed this May 11, 2013

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

Please do comment on how raw: true affects your performance @cflynn07

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

Hey Janmeir,

My performance increase is great! I just tried out your code -- went from ~22 seconds to ~0.05 seconds.

Might be a problem with eager-loading associations however. I'm seeing data that looks like this:

[
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "ccb2a09e-7bc8-448d-ab9c-2011004a72c6",
        "id": 1,
        "name": "thisischanged123",
        "type": "mini",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-10T22:20:50.000Z",
        "updatedAt": "2013-04-16T08:09:53.000Z",
        "deletedAt": "2013-04-16T08:09:53.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "ee58b0a0-248e-4c88-b4de-5d9f7e6db937",
        "id": 3,
        "name": "dogsandcats",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T01:41:33.000Z",
        "updatedAt": "2013-04-16T08:10:31.000Z",
        "deletedAt": "2013-04-16T08:10:31.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "67ecce1e-5dfc-4bbf-92a5-4200a803086f",
        "id": 5,
        "name": "newdogsandcats",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T07:16:33.000Z",
        "updatedAt": "2013-05-01T11:46:29.000Z",
        "deletedAt": "2013-05-01T11:46:29.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "806007f1-ef91-4d01-894c-79919f068660",
        "id": 6,
        "name": "newdogsandcats",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T07:49:23.000Z",
        "updatedAt": "2013-05-01T11:46:31.000Z",
        "deletedAt": "2013-05-01T11:46:31.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "a6c85807-106b-4c64-8e65-acfa11586c49",
        "id": 7,
        "name": "newdogsandcats",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T07:56:26.000Z",
        "updatedAt": "2013-05-01T11:46:32.000Z",
        "deletedAt": "2013-05-01T11:46:32.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "110757b7-ea2d-4d3d-9b5c-5ae06f87ef73",
        "id": 8,
        "name": "newdogsandcats",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T07:58:39.000Z",
        "updatedAt": "2013-05-01T11:46:25.000Z",
        "deletedAt": "2013-05-01T11:46:25.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "f2244262-51d3-4486-8e25-26017fe5ab20",
        "id": 9,
        "name": "newdogsandcats",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T07:59:30.000Z",
        "updatedAt": "2013-05-01T11:27:37.000Z",
        "deletedAt": "2013-05-01T11:27:37.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "1b9b632c-2c8f-4272-9f4c-775ea5d8c2f3",
        "id": 10,
        "name": "clientadmincreated",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T07:59:56.000Z",
        "updatedAt": "2013-05-02T22:08:46.000Z",
        "deletedAt": "2013-05-02T22:08:46.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "64ead8a3-8a59-4278-a3b2-12592723133a",
        "id": 11,
        "name": "clientadmincreated",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-04-16T08:00:22.000Z",
        "updatedAt": "2013-05-02T22:08:49.000Z",
        "deletedAt": "2013-05-02T22:08:49.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "f2a741aa-f085-4090-ad29-9b5efddf96bb",
        "id": 12,
        "name": "delta timer",
        "type": "mini",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-02T09:51:16.000Z",
        "updatedAt": "2013-05-02T22:08:43.000Z",
        "deletedAt": "2013-05-02T22:08:43.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "815e5cdd-2040-4ff1-a449-3fb977ad3b46",
        "id": 13,
        "name": "full expercise",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-02T09:51:30.000Z",
        "updatedAt": "2013-05-02T22:08:33.000Z",
        "deletedAt": "2013-05-02T22:08:33.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "68e88088-786b-4923-badf-c60a4f671112",
        "id": 14,
        "name": "Mini Exercise",
        "type": "mini",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-02T09:52:49.000Z",
        "updatedAt": "2013-05-02T22:08:36.000Z",
        "deletedAt": "2013-05-02T22:08:36.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "4e192acc-a7d6-4f5a-b519-9ac7b2c4737b",
        "id": 15,
        "name": "Test Template",
        "type": "mini",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-02T21:08:23.000Z",
        "updatedAt": "2013-05-02T22:08:39.000Z",
        "deletedAt": "2013-05-02T22:08:39.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "6867c1c5-2c75-465e-b735-88f50caaee85",
        "id": 16,
        "name": "TEST TEMPLATE 123",
        "type": "mini",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-02T21:09:15.000Z",
        "updatedAt": "2013-05-10T05:47:43.000Z",
        "deletedAt": null,
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "607af04b-e3b4-444c-a7f3-4ad4830d3ec3",
        "id": 17,
        "name": "wonderful new template",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-02T23:31:17.000Z",
        "updatedAt": "2013-05-02T23:31:25.000Z",
        "deletedAt": "2013-05-02T23:31:25.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "c151b58d-1457-4259-ad09-546d9e37d295",
        "id": 18,
        "name": "Division 10 Recovery Exercise",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-04T18:35:52.000Z",
        "updatedAt": "2013-05-08T02:55:56.000Z",
        "deletedAt": null,
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "65d56213-fde7-49cb-b8e6-04f5d1fa3b3a",
        "id": 19,
        "name": "New Template",
        "type": "mini",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-07T17:56:47.000Z",
        "updatedAt": "2013-05-08T03:36:52.000Z",
        "deletedAt": "2013-05-08T03:36:52.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "c523720a-57f6-42fc-8639-1e17e9514457",
        "id": 20,
        "name": "full template",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-08T02:51:30.000Z",
        "updatedAt": "2013-05-08T02:51:30.000Z",
        "deletedAt": null,
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "87e84df6-ca73-4ef3-9fe9-35f1ab2afbcb",
        "id": 21,
        "name": "NyQuil1",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-08T03:43:00.000Z",
        "updatedAt": "2013-05-09T00:44:25.000Z",
        "deletedAt": "2013-05-09T00:44:25.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "385fe478-6309-43cc-bcb2-27b18e44f79b",
        "id": 22,
        "name": "fdasdfasdf",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-11T18:35:56.000Z",
        "updatedAt": "2013-05-11T18:39:22.000Z",
        "deletedAt": "2013-05-11T18:39:22.000Z",
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
      "identifier": "casey",
      "firstName": "Casey",
      "lastName": "Flynn",
      "email": "casey_flynn@cobarsystems.com",
      "phone": "5555555555",
      "username": "casey",
      "type": "clientSuperAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:17:43.000Z",
      "updatedAt": "2013-05-11T09:07:49.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "6bc20097-a7f4-46bc-ac3e-f99b0ca57155",
        "id": 23,
        "name": "fdasdfasdf",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "45b7c719-2049-4a44-ad9c-09e858afc48b",
        "createdAt": "2013-05-11T18:36:07.000Z",
        "updatedAt": "2013-05-11T18:36:07.000Z",
        "deletedAt": null,
        "clientId": 1,
        "employeeId": 1
      }
    },
    {
      "uid": "04ad5b05-c9a5-430f-8d5c-8483d5d904e4",
      "identifier": "erici",
      "firstName": "divis",
      "lastName": "rrrrrrrr",
      "email": "eric_canter@gmail.com",
      "phone": "5555555555",
      "username": "sdf",
      "type": "superAdmin",
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-04-10T22:18:16.000Z",
      "updatedAt": "2013-05-11T08:51:29.000Z",
      "deletedAt": null,
      "templates": {
        "uid": "c6268022-fdc2-465d-98c3-8c6195fb9aa9",
        "id": 4,
        "name": "mangolians",
        "type": "full",
        "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
        "employeeUid": "04ad5b05-c9a5-430f-8d5c-8483d5d904e4",
        "createdAt": "2013-04-16T01:41:33.000Z",
        "updatedAt": "2013-05-02T09:43:39.000Z",
        "deletedAt": "2013-05-02T09:43:39.000Z",
        "clientId": 1,
        "employeeId": 2
      }
    },
    {
      "uid": "079fea0c-3ca4-4891-80f2-4b0a520b8141",
      "identifier": null,
      "firstName": "Gus",
      "lastName": "H Ventura",
      "email": "gus_hventura@company.com",
      "phone": "1-(146)-146-8485",
      "username": null,
      "type": null,
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-05-11T20:23:51.000Z",
      "updatedAt": "2013-05-11T20:23:51.000Z",
      "deletedAt": null,
      "templates": {
        "uid": null,
        "id": null,
        "name": null,
        "type": null,
        "clientUid": null,
        "employeeUid": null,
        "createdAt": null,
        "updatedAt": null,
        "deletedAt": null,
        "clientId": null,
        "employeeId": null
      }
    },
    {
      "uid": "07bdc017-b98a-4001-b7e4-031bedcd5579",
      "identifier": null,
      "firstName": "Abdullah",
      "lastName": "ALghamdi",
      "email": "abdullah_alghamdi@company.com",
      "phone": "1-(431)-767-8039",
      "username": null,
      "type": null,
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-05-11T20:23:51.000Z",
      "updatedAt": "2013-05-11T20:23:51.000Z",
      "deletedAt": null,
      "templates": {
        "uid": null,
        "id": null,
        "name": null,
        "type": null,
        "clientUid": null,
        "employeeUid": null,
        "createdAt": null,
        "updatedAt": null,
        "deletedAt": null,
        "clientId": null,
        "employeeId": null
      }
    },
    {
      "uid": "b4fa534e-942b-4f5f-b6e6-8fdc53c94397",
      "identifier": null,
      "firstName": "Betsy",
      "lastName": "Elliott",
      "email": "betsy_elliott@company.com",
      "phone": "1-(109)-253-3291",
      "username": null,
      "type": null,
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-05-11T20:23:51.000Z",
      "updatedAt": "2013-05-11T20:23:51.000Z",
      "deletedAt": null,
      "templates": {
        "uid": null,
        "id": null,
        "name": null,
        "type": null,
        "clientUid": null,
        "employeeUid": null,
        "createdAt": null,
        "updatedAt": null,
        "deletedAt": null,
        "clientId": null,
        "employeeId": null
      }
    },
    {
      "uid": "18e7ff7b-0f6d-43cc-81f6-f1431fdb87f7",
      "identifier": null,
      "firstName": "Michael",
      "lastName": "Hanna",
      "email": "michael_hanna@company.com",
      "phone": "1-(813)-370-3723",
      "username": null,
      "type": null,
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-05-11T20:23:51.000Z",
      "updatedAt": "2013-05-11T20:23:51.000Z",
      "deletedAt": null,
      "templates": {
        "uid": null,
        "id": null,
        "name": null,
        "type": null,
        "clientUid": null,
        "employeeUid": null,
        "createdAt": null,
        "updatedAt": null,
        "deletedAt": null,
        "clientId": null,
        "employeeId": null
      }
    },
    {
      "uid": "4e9a7c86-a456-4d17-aff8-5e0c711d3333",
      "identifier": null,
      "firstName": "Jessica",
      "lastName": "Bal",
      "email": "jessica_bal@company.com",
      "phone": "1-(194)-417-1984",
      "username": null,
      "type": null,
      "clientUid": "44cc27a5-af8b-412f-855a-57c8205d86f5",
      "createdAt": "2013-05-11T20:23:51.000Z",
      "updatedAt": "2013-05-11T20:23:51.000Z",
      "deletedAt": null,
      "templates": {
        "uid": null,
        "id": null,
        "name": null,
        "type": null,
        "clientUid": null,
        "employeeUid": null,
        "createdAt": null,
        "updatedAt": null,
        "deletedAt": null,
        "clientId": null,
        "employeeId": null
      }
    },
........

As you can see some parent objects are repeated for each of their children, and parents without child objects have 'stubs' or child object literals will all null values for each property.

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

Actually I'm not seeing this anymore... maybe I did something but that issue appears to have gone away

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

Strange but good!

I have not implemented any of the eager loading code, so I couldn't answer how the mapping is done. But if the issue should arise again, feel free to re-open this issue.

@janmeier janmeier reopened this May 11, 2013

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

Ahhhhh actually it's still there, I had just unknowingly reverted back to the standard unmodified version of sequelize and I saw it go away.

@cflynn07

This comment has been minimized.

cflynn07 commented May 11, 2013

Almost there, seems like a bug in the eager loading

@janmeier

This comment has been minimized.

Member

janmeier commented May 11, 2013

We'll have to attract to attention of @sdepold then to get a couple of hints on eager loading

@mickhansen

This comment has been minimized.

Contributor

mickhansen commented May 12, 2013

There's probably some looping that is heavy on the performance.

@cflynn07

This comment has been minimized.

cflynn07 commented May 13, 2013

@sdepold , any insight on if it's possible to do nested associations with raw queries?

@cflynn07

This comment has been minimized.

cflynn07 commented May 22, 2013

ping

@sdepold

This comment has been minimized.

Member

sdepold commented May 23, 2013

hi peeps. with raw queries you mean you want to get the raw result?

@cflynn07

This comment has been minimized.

cflynn07 commented Jun 20, 2013

Hi sdepold, yes please. -- not with raw queries but with getters

@ghost ghost assigned durango Jul 31, 2013

@mickhansen mickhansen closed this Feb 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment