Skip to content

Add WhereInClause function#14

Merged
stephenafamo merged 3 commits intoaarondl:masterfrom
IOTechSystems:master
Apr 9, 2024
Merged

Add WhereInClause function#14
stephenafamo merged 3 commits intoaarondl:masterfrom
IOTechSystems:master

Conversation

@jakeiotechsys
Copy link
Contributor

In postgres, a WHERE OR statement will take a considerable amount of time to process a query containing many args. Up to 15 minutes in our tests for 15k db entities. Most of this came from the query optimisation stage, and after that stage the db chose to search the table sequentially which is very slow.

Using a WHERE IN statement, foreign key tables are joined, resulting in a query execution time of ~90ms for 15k entities.

More information about this speed increase can be found here: https://stackoverflow.com/questions/68484681/why-in-is-so-much-faster-than-in-sql-select

@stephenafamo stephenafamo changed the title DeleteAll changed to using WHERE IN instead of WHERE OR Add WhereInClause function Apr 9, 2024
@stephenafamo stephenafamo merged commit 0a61053 into aarondl:master Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants