loopback icon indicating copy to clipboard operation
loopback copied to clipboard

User model has no index for email attribute by default

Open siegiw opened this issue 9 years ago • 2 comments

This has a major performance hit on login by email for large user scale, at least on my postgres db. Annoying especially when using autoupdate, resulting in drop of indices that were manually created

from loopback user.json:

  ...
  "properties": {
    "realm": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "password": {
      "type": "string",
      "required": true
    },
    "email": {
      "type": "string",
      "required": true
    },
    "emailVerified": "boolean",
    "verificationToken": "string"
  },
  ...

I tried subclassing user and defining an appropriate index, which unfortunately results in erratic creating/destroy of the email index, possibly due to race conditions:

from common/models/user.json:

   ...
  "properties": {
    "email": {
      "type": "string",
      "required": true,
      "index": true
    }
  },
  ...

siegiw avatar Feb 13 '17 22:02 siegiw

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Sep 06 '17 15:09 stale[bot]

This is a major issue. I am wondering why it has no response whatsoever. Is nobody facing this? Is it not a valid issue? Is there an obvious workaround? Can somebody please update this issue with some useful guidance.

jpradeep2003 avatar Mar 28 '18 12:03 jpradeep2003