Repository navigation
Description
Issue Creation Checklist
- I understand that my issue will be automatically closed if I don't fill in the requested information
- I have read the contribution guidelines
Feature Description
Describe the feature you'd like to see implemented
Hi, are there any plans to improve performance on the query/result path in Sequelize?
We have a Node.js API built with Express, PostgreSQL as the database and Redis for caching. Sequelize 6 is our ORM. During load testing we profiled the API processes, and Sequelize itself (plus the lodash calls coming from it) took roughly 30–39% of the busy CPU time. The database was not the bottleneck; the API processes were CPU-bound.
To make sure this wasn't caused by how we use it, we ran the same four queries through Sequelize models, drizzle-orm, Kysely and plain pg, against the same database and returning the same rows. The numbers are below. Sequelize models came out about 2.7x slower than drizzle and 3.8x slower than Kysely, mostly because of client-side CPU per query (about 0.39 ms vs 0.10–0.14 ms).
We don't have a specific API change in mind. Mainly we'd like to know:
- whether query/result-path performance is something you're working on (for v6 or v7),
- whether there are options we might be missing that reduce this overhead (we already use
attributeseverywhere andthrough: { attributes: [] }on many-to-many includes).
Setup
- Node.js 24, PostgreSQL 13, Sequelize 6.37.8, pg 8.23.1, drizzle-orm 0.45.4, Kysely 0.29.6
- Same machine and same database (~1.6 GB of generated data), same pool size (12), 12 queries in flight
- Each side in its own process, 20 s per run, 3 rounds with the sides interleaved; we report the median
- All sides return identical results (checked with a fingerprint of the returned rows)
- We ran the whole benchmark again on another day and got the same ratios
Query mix (35 / 25 / 25 / 15 %):
// 1. find by primary key with a many-to-many include
User.findByPk(id, {
attributes: [/* 7 columns */],
include: [{ model: Role, as: 'roles', attributes: [/* 4 columns */], through: { attributes: [] } }],
});
// 2. list with a filtered one-to-many include, two-column order, limit
Item.findAll({
attributes: [/* 5 columns */],
where: { isActive: true, isPublic: true },
include: [{ model: ItemTranslation, as: 'translations', attributes: ['name'], where: { language: 'en' }, required: false }],
order: [['displayOrder', 'ASC NULLS LAST'], ['createdAt', 'DESC']],
limit: 40,
});
// 3. simple list: where + order + limit, no include
Message.findAll({ attributes: [/* 5 columns */], where: { userId: id }, order: [['createdAt', 'DESC']], limit: 20 });
// 4. count with an OR
Link.count({ where: { status: 'accepted', [Op.or]: [{ userId: id }, { otherId: id }] } });Results: same four queries
| Sequelize models | drizzle-orm | Kysely | plain pg | |
|---|---|---|---|---|
| Queries / s (median of 3) | 2,738 | 7,255 | 10,409 | 21,651 |
| Relative to Sequelize | 1x | 2.65x | 3.80x | 7.91x |
| Client CPU per query | 0.39 ms | 0.14 ms | 0.10 ms | 0.05 ms |
| Latency p50 / p95 (avg of the 4 queries) | 3.9 / 7.6 ms | 1.5 / 2.7 ms | 1.1 / 1.8 ms | 0.5 / 0.8 ms |
| Process RSS | 219 MB | 178 MB | 150 MB | 133 MB |
Results: raw SQL path (same SQL text, separate run)
| plain pg | sequelize.query(sql, { type: QueryTypes.SELECT }) |
|
|---|---|---|
| Queries / s (median of 3) | 14,704 | 10,243 |
| Client CPU per query | 0.070 ms | 0.101 ms |
Even with raw SQL, Sequelize adds about 30% client CPU on top of the driver.
Profile under load (3 API processes, steady state, share of busy CPU time)
| Component | Share |
|---|---|
| sequelize | ~30% |
| lodash (mostly called from sequelize) | ~9% |
| sequelize-pool | ~0.5% |
Describe why you would like this feature to be added to Sequelize
The overhead is in the core path that every query goes through: building options, generating SQL, and building instances and includes from the result. A separate package can't really change that. For us the alternative is to move our hottest queries to a query builder, which means running two data layers side by side. We'd rather stay on Sequelize if this gap can get smaller.
Is this feature dialect-specific?
- No. This feature is relevant to Sequelize as a whole.
- Yes. This feature only applies to the following dialect(s):
(We only measured on PostgreSQL, but the overhead is on the JavaScript side.)
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I will need guidance.
- No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
- No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in implementing my feature.
Indicate your interest in the addition of this feature by adding the 👍 reaction. Comments such as "+1" will be removed.
Activity
SippieCup commentedon Oct 19, 2026
7v has a completely rewritten query builder and hydration engine which in worse case is (R*C)^2 faster, in reality you can see hydration is 3x more CPU efficient and gets on average 70% faster across queries, for queries like yours, I can see it being even higher.
See #18051
I would run your benchmarks against v7 to see how it runs.
ramazansancar commentedon Oct 19, 2026
Hi @SippieCup,
I'll be running a benchmark test with v7 within a week and adding the results here.
I have a quick question: when do you plan to release v7?
Thanks.
ramazansancar commentedon Oct 19, 2026
Thanks @SippieCup. We ran the same benchmark against v7 and also went through a few older versions to see how things changed over time.
In our case
@sequelize/[email protected]turned out about 20% slower than[email protected]on the model path. Alphas 43, 46, 47 and 48 all give the same numbers, so for our queries we can't see a difference from #18051. That makes sense to us: our results are small (40 rows at most, one level of include), and that PR mostly helps hydration of big result sets.We profiled v7 and most of the gap comes from two small places. When we changed both of them locally, v7 was as fast as v6. Details below.
Setup
Mostly the same as in the first post. The database is PostgreSQL 17 now (it was 13 before), but that didn't change the client-side numbers: the app's own v6 models gave 2,786 q/s now and 2,738 q/s last time.
To keep the comparison fair, v6 and v7 load the same model file: 7 models with only the columns the queries use, the same associations, and the same
through.scopeon the many-to-many. So the only thing that changes between them is the library. The queries are the four from the first post (35/25/25/15 mix).Model definitions (shared by v6 and v7)
v6 is created with
new Sequelize(db, user, pass, { dialect: 'postgres', host, port, logging: false, pool: { max: 12, min: 2 } }),v7 with
new Sequelize({ dialect: PostgresDialect, host, port, user, password, database, logging: false, pool: { max: 12, min: 2 } }).Model path: v6 and v7 versions
All in one run, each version installed in its own folder.
For reference, from the same run with the same queries:
The v7 slowdown is spread over all four queries, including the two that have no include at all. So it isn't only hydration. The process is CPU-bound with 12 queries in flight, so latency here mostly reflects CPU time per query.
findByPk+ many-to-many includefindAll+ filtered hasMany include, order, limit 40findAll, where + order + limit 20, no includecountwithOp.orOne SQL difference we noticed: for query 1, v7 wraps the user in a subquery with
ORDER BY "User"."id" LIMIT 1before joining the roles. v6 does a flat join. It returns the same rows and doesn't seem to matter for the DB here, but it's different.Query 1 SQL, v6 vs v7
v6:
v7 alpha.48:
What the profile shows
We took a CPU profile (
node --cpu-prof) of v6 and v7 doing the same 20 s run and counted self time per query in the steady part, ignoring startup.isModelStaticfixnode:internal/*, in v7 mostly the module loader)So the core code itself costs about the same in both versions. The difference comes from two things: the module loader showing up on the hot path, and more lodash work.
1.
isModelStaticcallsrequire()every time. Inpackages/core/src/utils/model-utils.ts:It gets called many times per query, for example
selectQuery→getQueryOrders→quote→isModelStatic. Even when the module is cached,requirestill goes through resolution, and that's whereinternalModuleStat,lstatandpackage_json_readercome from in the profile. In a small loop one call takes about 850–975 ns. The sameinstanceofcheck inline takes about 10 ns. It's the same onmaintoday.2. The
Modelconstructor deep-copies the options for every instance. In alpha.48lib/model.js:lodash
omitclones deeply, and this runs once per row. That's about 29 µs per query for us (query 2 builds 40+ instances). In v6 the same line is justthis._options = options;.There's also
rejectInvalidOptionscalling lodashpickByon every call (~11 µs per query). We didn't touch that one.Trying the two fixes
We changed the alpha.48 build output in a separate folder and ran it next to unpatched v6 and v7:
The second one is a shallow copy instead of a deep one, so it's probably not a drop-in fix. We only wanted to see how much it costs.
isModelStaticfixomitin the constructorWith both changes alpha.48 lands right where v6 is (3,161 vs 3,189). The
isModelStaticone looks safe to us. We'd be glad to send a PR for it if you want.Raw SQL path
Same SQL text on every side,
sequelize.query(sql, { type: QueryTypes.SELECT, bind }). This ran in a separate container (Node 24.22.0), so the absolute numbers don't line up with the tables above.This is a big improvement in v7, it's very close to the driver now. One thing though: v7 gives back
timestamptzcolumns as strings in raw queries ("2026-10-19 08:20:00.03+00"), while pg and v6 giveDateobjects. So some of this comes from not parsing dates. We guess that's on purpose, just mentioning it.If it helps, we can share the full benchmark script, or run it against a build from
mainor a branch.ramazansancar commentedon Oct 19, 2026
I will experiment with further performance improvements and share my findings in the comments. This may take some time. Thank you for your understanding.
ramazansancar commentedon Oct 19, 2026
A follow-up with more data. We took the hot spots from the profile, turned each one into a small patch, and measured every patch alone and in every combination, for both v6 and v7.
First, a correction to my last comment: the table sizes were wrong. I took them from our generator's counters, not from the tables. The real numbers are about 21.3k users, 23.8k user-role rows and ~497k rows in the messages table. All sides ran on the same data, so the results don't change.
How we ran it
Same four queries, same machine and setup as before (Node.js 24.21.0, PostgreSQL 17.11, pg 8.23.1, pool 12, 12 in flight, 20 s per run). Each patch combination is installed in its own folder and patched in the published build output (
lib/), so nothing else changes between sides. 3 rounds, sides interleaved, median reported. Rounds were within ±3%. We also checked before every round that nothing else on the host (Windows Defender in particular) was using the CPU. Every side returned identical results.Baselines:
@sequelize/[email protected]2,439 q/s and[email protected]3,059 q/s, with the same model definitions.v7:
isModelStaticcallsrequire()on every call+12.8% on average (+11.3% to +15.5% depending on what else is applied). Same behavior, just no module resolution on the hot path.
v7: the
Modelconstructor deep-clones its options per instance+10.3% on average (+8.8% to +13.6%). lodash
omitclones deeply and this runs once per row. v6 just keeps a reference (this._options = options). We're not 100% sure nothing relies on_optionsbeing a deep copy, so this one needs a closer look.v7:
rejectInvalidOptionsusespickByon every call+5.3% on average (+3.9% to +7.7%). Same result, no intermediate object.
v6: esbuild's object spread helpers
The v6 build turns every
{ ...a }into__spreadValues/__defNormalPropcalls. These two helpers took about 24 µs per query in our profile. As an experiment we replaced the helper in the build output withObject.assign(36 files):+10.0% on average (+9.0% to +11.1%). The proper fix would be a newer esbuild
target, so the spread stays native (v7's build already does this). There's one small difference from the helper:Object.assigncalls setters if a key exists on the target's prototype. For plain option objects that shouldn't matter.Experiments that change behavior (cost only, not proposals)
run()createsnew Error()for every query (dialects/postgres/query.js, to keep the call-site stack for DB errors). Without it: +7.0% (+5.8% to +8.2%). That stack is useful, so this is just to show what it costs. Capturing it lazily isn't possible, but maybe it could be opt-out.options = cloneDeep(options)infindAll/findOne/count/ … (both versions, 10 places inmodel.js). A shallow copy instead: +3.2% in both v6 and v7. This isn't safe as it is, because the caller'sincludeobjects would get mutated. It just shows the defensive copy isn't where most of the time goes.raw: trueNot a patch, just for scale. Our queries with
raw: true(query 1 viafindAll, becausefindByPk+rawonly keeps the first joined row):isModelStatic+omit+rioSo building model instances is still the biggest single cost on both versions.
All combinations
Latency columns below are the average of the four queries' p50 / p95 / p99 (12 in flight). The patches don't interact much: pairs land close to the sum of the single effects (v7
isModelStatic+omit+23.3% vs +21.7% summed; v6 stack + spread +16.9% vs +17.8%).isModelStaticomitrioisModelStatic+omitisModelStatic+rioomit+rioisModelStatic+omit+rioclone(experiment)new Error()per query (experiment)new Error()new Error()+ shallowclonePer query, for the baselines and the best safe combinations (p50 / p95 / p99 ms):
findByPk+ many-to-many includefindAll+ hasMany include, order, limit 40findAll, no includecountwithOp.orEvery combination: q/s, client CPU, latency (3 rounds each)
Latency is the average of the four queries' p50 / p95 / p99. With 12 queries in flight and a CPU-bound process, latency mostly follows CPU per query.
One more thing: v5 vs v6
In another run (same queries and model definitions, Node 24.22.0 in a separate container),
[email protected]did 3,407 q/s and[email protected]did 2,794 q/s, so v5 is about 18% faster.Across v6 itself the drop is small (6.28.0 → 6.37.8 is about −3%), so most of it seems to be from the v5 → v6 move. Our guess is that the esbuild spread helpers are part of it, since v5 shipped untranspiled JS. We haven't verified that.
The three v7 changes (
isModelStatic, the constructoromit,rejectInvalidOptions) look safe to us, and together they take v7 past v6. We can open PRs for them if you'd like, maybe starting withisModelStatic, which is a one-line change.ramazansancar commentedon Oct 19, 2026
One more, for context. While we were at it we ran the same four queries through every other ORM, query builder and SQL library we could find, plus a few other databases. It's not a Sequelize problem as such, but it shows where Sequelize sits next to the alternatives, and it might be useful when you look at the hot paths.
Same setup and data as in the last comment, and every side returned the same rows. One thing to keep in mind: each table is a separate run, and some ran inside our API container (Node 24.21.0) while others ran in their own container (Node 24.22.0). So it's better to compare rows within a table rather than across tables. Latency is the average of the four queries.
ORMs and query libraries on PostgreSQL 17
pg(ids only)Plain
pghere only selects the id columns (it's the reference from our earlier runs). The SQL libraries (postgres.js, pg-promise, @databases/pg, Slonik) select the same columns as the ORMs. Prisma 7 uses@prisma/adapter-pgwith the new query compiler. For Objection, MikroORM and TypeORM the user-role join row is its own model, since their many-to-many filters can't see the join table.TypeORM and Knex were measured in a different run, so here they are with the ones they shared a run with:
pgDriver layer
Same SQL text on every side, no ORM:
pg-nativepgsequelize.queryover pgsequelize.queryover pg-nativesequelize.queryover pg-nativesequelize.queryover pg@sequelize/corereturnstimestamptzas a string in raw queries, whilepgand v6 returnDate. So part of v7's raw-path number comes from not parsing dates.pgvspg-nativeunder each librarypgq/spg-nativeq/sTypeORM picks up
pg-nativeby itself if it's installed, so for the "overpg" row we had to hand it apgmodule withnativehidden.Versions
Other databases
Single node each (official images, on the same machine as everything else). Only the libraries that support the database are listed.
pg; ClickHouse:@clickhouse/client1.24.1)sequelize-cockroachdb6.0.6)@founderpath/kysely-clickhouse1.7.0)Database server CPU per 1,000 q/s on the plain driver path (sampled from the containers, so rough): PostgreSQL 24, CockroachDB 95, YugabyteDB 124, ClickHouse 743. CockroachDB and YugabyteDB are built to scale out, so a single node isn't their best case. ClickHouse is a columnar engine and isn't meant for point reads like these. We did not test Couchbase: none of the SQL ORMs above support it (Couchbase's own ODM is Ottoman), and with a document model the queries wouldn't be the same work.
DM8 (Dameng)
We were also curious about DM8 (it's often described as Oracle-like), so we tried it. It ran from a third-party Docker image with a developer license, on an internal network.
pg)dmdb1.0.52452)sequelize-dm85.0.9 (v5 fork)typeorm-dm1.0.49630knex-dm1.0.52452The DM8 server itself used less CPU per query than PostgreSQL in this run (~17 vs ~27 per 1,000 q/s). Most of the gap is in the Node driver:
dmdbused about 13x the client CPU per query ofpg.sequelize-dm8is a third-party fork of Sequelize v5, so this part isn't on you. With currentdmdbit fails as soon as there's more than one connection: it creates admdbpool per connection, anddmdbnow names every pool'default'([20006]). We worked around it to measure it. It also puts the values straight into the SQL text, which may be why the server CPU per query was so high for it (we haven't verified that).If any of this is useful for the v7 work and you'd like the raw numbers or the scripts, just say.
ramazansancar commentedon Oct 19, 2026
A small follow-up: in the earlier comments we only measured TypeORM 0.3.31. We used that version because the DM8 dialect (
typeorm-dm) needstypeorm@^0.3.20, and then we kept it for the other databases too. We missed testing the current release, TypeORM 1.1.2 (Oct 8). So here are 0.3.25 through 1.1.2 on the same setup, plus one ranking of everything we measured.TypeORM versions
Same four queries and data as before, one run, 3 rounds, sides interleaved. This run was noisier than the earlier ones: rounds varied by up to ±7% instead of ±3%. Our guess is the CockroachDB and YugabyteDB containers sitting next to it. So only differences where the rounds don't overlap count. Rows marked
pg-nativehavepg-nativeinstalled, which TypeORM picks up by itself.pg-nativepg-nativepg(reference)On
pg, 1.1.2 is about 10% slower than 0.3.31 (5,691–5,871 vs 6,411–6,486 across the rounds, so the ranges don't overlap). 1.0.0 is a little below 0.3.31 (about 3%), and the bigger drop comes with 1.1.0. Withpg-nativethe gap mostly goes away (6,394 vs 6,609).Same two versions on single-node CockroachDB and YugabyteDB:
Here the rounds overlap on both databases, so we wouldn't read anything into these.
Everything in one ranking
Fastest to slowest, PostgreSQL 17, latest version of each library. The libraries were measured in different runs, so the rank uses each library's ratio to Sequelize 6.37.8 measured in the same run (every run had Sequelize in it). The absolute q/s is shown next to it. Latency is the average of the four queries.
Ceiling, same run as A: plain
pgselecting only the ids, 22,298 q/s (7.32x), 0.046 ms CPU / query.Runs:
pg/pg-nativerun.TypeORM 1.1.2 is ranked from run C, which was the noisier one.
SippieCup commentedon Oct 19, 2026
Sequelize 6 is basically EoL, we won't be adding performance patches to it, so comparing sequelize versions that arent 7 to other stuff is kinda pointless.
That said, we should be closer to the other ORMs with your findings on 7.
Sequelize 7 is in 'alpha' only because we don't have the CLI done yet, and there might be a couple API definitions that we want to change which are breaking for people using it. Thus, we have kept it in alpha until we can get to it as the API definition changes could mean rewriting a whole bunch of queries across an application using it.
Those API changes though.. I doubt will happen, and even if they are. a well crafted prompt and codegen schematic would be able to fix it for users now. So I think we will be moving it out of alpha soon. Once Generated columns are in for sure.
That said, I have been using it in production for several years now. and there absolutely no reason not to if you are doing active development. We just did not want to have users building on somehting that would then be stuck out of date and require rewrites etc.
I will say we use sequelize very differently, while I obviously do have a lot of quick queries like yours, I also work on a lot of big data with deeply nested models where hydration takes up most of the time, so I haven't refined the query builder as much as it could be refined, as it was still a small percentage of the overall work being performed with my tests.
Regarding your posts:
this is intentional to fix an issue within older versions of sequelize when setting limits on parent/nested models. Before if you were to set like limit 10, it would limit the total number of rows. If all 10 of those rows were all the same parent row, User in your case, and the first User had 100 messages in a subquery, it would return the first user with 10 messages. not 10 Users with all thier messages.
subquery: falsein the query will make it work the same way without subqueries, but doing ti as subqueries is more efficent.Nice catch. If you have a PR for v7 already, I can merge that.
we should keep working on removing that too..
I would love you to submit these patches as PRs for us so I can merge them now with your attribution. These are definitely oversights that I missed, and had me scratching my head as to how it was so much slower.. thanks for catching it. I will merge asap.
While reading, I was betting the slowness in query generation was the over-reliance on regex and validation for the query building, rather than doing it correctly by construction. Ideally, there would be very little regex in query generation, rather than being the primary driver This is a legacy thing that has just not been addressed yet. But it shouldnt be that bad as your benchmarks show. Your fixes to the hotpath are greatly appreciated.
This is because we have added temporal api, and soon luxon, support to the alpha. which means not having it return Date objects as default.
Date()just has a bunch of issues as im sure you are aware of, that said if you type your model to beDatewithin the model definition it will return a date object for you. This is just you likely having a legacy model definition.I think this might be useful to have an opt-out configuration on a per-query or globally. @WikiRik I would like your opinion onn the matter. The issue becomes when these issues happen in production, you really have no idea why. That said, angular does a similar thing with production mode.
This we cant do. we intentionally deep clone to protect against contamination between shared callers when working on hooks and nested models.
For example: through models runs
defaultsLodash(include.through, {...})and then ANDsthrough.scopeintothrough.where.With a shallow copy, that writes into the caller's object. Each reuse adds the scope one more time, so the SQL grows on every call. It also stores a parent pointer back. A module-level const INCLUDE = [...] is very common, which would mean that those hooks would not get overwritten by that query's particular changes. This happens with like.. timestamps and paranoid hooks at a global level.
The better solution is to just make a better clonedeep function, that suits our particular usage. rather than shallow copy.
the constructor fix and rio are probably good to merge. if you open PRs.
isModelStatic actually has an open PR that should be able to do it here: #18234 So i'll just review that tonight and see if there is anything more needed. I thought that was actually part of the rollup when 48 shipped which is why i was confused.
For RIO. you can probably speed it up a bit more, if you look at
quoteTable(), it gets used and loops through every option. but we only actually useindexHintsandtableHintsin it. so we can loop through those instead, and then get the values from a direct assignment instead of going though the massive for loop.that'll speed it up a crap ton more.
If you open the two PRs for the constructor and RIO, I would appreicate it :)
Also If you share your benchmarking with me. I can continue to iterate and bring it down. That said, the 3 things you pointed out should give like a 30% improvement from the current baseline.
WikiRik commentedon Oct 19, 2026
I haven't actively looked at performance improvements yet, I think we can ship some before v7 comes out but I don't think we should focus on it.
For the
new Error()specifically; I think we can look into a per-query opt-out for the queries that people know they don't need the error stack on. Adding an opt-out globally sounds too risky to me atm, but if there's real demand for it we can always add it laterramazansancar commentedon Oct 19, 2026
Thanks a lot for the detailed replies, that clears up a lot. @SippieCup @WikiRik
A correction to my earlier comment first: I said lodash
omitdeep-clones there. It doesn't. With a single top-level key it makes a shallow copy. The cost comes from collecting every key withgetAllKeysIn(own and inherited, plus symbols) and thenbaseUnset, once per instance. So the rest copy (const { comesFromDatabase, ...rest } = options) should be equivalent for plain option objects, not just "probably fine".I opened the two PRs you asked for:
Modelconstructor changerejectInvalidOptionsusing your loop overallSupportableOptionsMeasured against a build of current
main(d191d5b), not the alpha.48 release, sincemainis quite a bit ahead: the constructor change is 1.09x, the loop 1.06x, and both together 1.16x on the same four queries. Details are in the PRs.@WikiRik understood that performance isn't the focus before v7, so these are meant as small, low-risk changes. A per-query opt-out for the
new Error()would work for us. We'd only use it on a few hot read paths anyway, so a global switch isn't something we need.On #18234, one more data point that might help it along. When I ran the benchmark directly on a Windows host instead of in a Linux container, stock alpha.48 dropped to ~400 q/s (v6: ~2,100 on the same machine). With only
isModelStaticcached it went back to ~2,000 q/s. On Linux that fix was +11–15%, but on Windows the per-callrequire()seems to go to the file system each time, so it's closer to 5x. Anyone developing on Windows probably sees v7 as a lot slower than it really is.The benchmark is here: https://github.com/ramazansancar/sequelize-orm-bench. It has the same four queries on synthetic data (seed script included), and v6 and v7 share one model file. Everything runs in Docker, one compose file per comparison, and
compose.builds.ymlruns local builds (packed.tgzfiles) next to each other, which is how the PR numbers were made. If you want other query shapes in it, let me know and I'll add them.The rest makes sense to us. On the dates, our case was raw
sequelize.query()with no model, so strings there are expected. Thanks for thesubQuery: falsetip too. And agreed oncloneDeep: a clone that only walks the parts it needs (include trees, where objects) sounds like the right way to go. I can look into that later if it helps.ramazansancar commentedon Oct 19, 2026
Full numbers from the benchmark repo for #18556 and #18557, in case they're useful here too.
Setup: Node 24.22.0 and PostgreSQL 17 in Docker (
compose.builds.yml), synthetic data (21k users, 500k messages). Four read queries mixed 35/25/25/15, 12 in flight, 20 s per run, 5 interleaved rounds, median. Every build was packed from its branch, and all four returned the same results (same fingerprint), 0 errors.main(d191d5b)rejectInvalidOptions)Latency per query, p50 / p95 / p99 in ms:
mainWith 12 queries in flight the process is CPU-bound, so the latency drop follows the CPU per query. Memory stays the same (226-230 MB RSS).
To reproduce: put the packed
core,postgresandutilstarballs of each branch inbuilds/<name>/and rundocker compose -f compose.builds.yml run --rm bench.ramazansancar commentedon Oct 22, 2026
I’m going to spend some more time on the improvements here. So, even though two PRs are already included, it looks like I might open a few additional ones. I’ll post an update here in a couple of weeks.
PRs: https://github.com/sequelize/sequelize/pulls?q=is%3Apr+state%3Aclosed+author%3Aramazansancar