sequelize-typescript
sequelize-typescript copied to clipboard
how to improve findAll operation speed
Issue
l have created the table with index in sqlserver, the table has 6000 data and it include 4 tables, i query it only need 0.2 seconds, but use Model.findAll({include:[tabel1,table2,table3]}) will need 12 seconds ,how can l improve the speed? if use index, hope telling me how to use @index to corresponde the index of table has been created
Versions
- sequelize: v6
- sequelize-typescript: v6
- typescript:
Issue type
- [ ] bug report
- [x] feature request
Actual behavior
Expected behavior
Steps to reproduce
Related code
insert short code snippets here
I'm having the same issue when i try to findAll with include all and nested true options it greatly increase the amount of time that it takes to give a result (i have about 10+ relations (oneToOne) in a table and the more i add them to sequelize the slower it takes). I've done some testing removing sequelize-typescript dependency and the speed just comes back to normal. Is there any way to fix this?
sequelize-typescript
doesn't really modify this, if it's the library issue, it's probably down to sequelize
, so might be better to check there for support.
Though, would be helpful to share your code snippets and DB setup as it might be down to it.
Yeah, yesterday i was testing again the code (with sequelize-typescript) and it was very fast again to fetch data. So we discarded the idea it was sequelize-typescript. It is kinda crazy some times it takes 8s and in another day takes 200ms, i really wonder whats going on to this to happen.
@namett3 please try include models with separate: true
flag. Maybe it helps you.