veliovgroup / mail-time

📮 Email queue extending NodeMailer with multi SMTP transports and horizontally scaled applications support

Home Page:https://www.npmjs.com/package/mail-time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More performant index

PeteMac88 opened this issue · comments

I'm having an issue:

I observed that after that the interval query generates quite a lot of load on the database after a while in case the keepHistory option is enabled. The problem is that the query in the __send function is triggering the compound index which first index sentAt is a timestamp. Because of the timestamp the database always needs to search a lot of index keys before returning the reults.

I have a suggestion:

I would suggest putting the isSent index as the first index of the compound index.

I added a PR #35

@PeteMac88 published as v1.3.4