How to Suppress SELECT query after INSERT?
See original GitHub issueIssue type:
[x] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[x] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[ ] latest
[ ] @next
[x] 0.2.9
(or put your version here)
I am executing the following line of code in a transaction using entity manager
await entityManager.insert(
CriteriaClause,
{
customerId: clause.customerId,
criteriaStatementId: clause.criteriaStatementId,
criteriaPhraseNum: clause.criteriaPhraseNum,
fieldName: clause.fieldName,
lowValue: clause.lowValue,
highValue: clause.highValue,
criteriaOperatorId: clause.criteriaOperatorId,
criteriaTableId: clause.criteriaTableId,
modifiedBy: clause.modifiedBy
},
{ reload: false }
);
When this code executes, it’s extremely slow because of the select
query after the insert
. My understanding is that setting the reload
option to false should suppress the query. If this is not the way, how would I do that?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Suppress result from insert trigger - sql - Stack Overflow
After a quick review of your query my first thought is that you're getting results due to the select * from #inserted.
Read more >How to suppress MySQL stored procedure output?
To suppress MySQL stored procedure output, you can use variable. Let us first create a table. mysql> create table person_information ...
Read more >Slow select after bulk insert-remove - Ask TOM
3. Remove all rows from table t_reg_account using DELETE statement. 4. Execute select from 2. Now the same query consumes several hundreds of ......
Read more >INSERT INTO SELECT statement overview and examples
This article covers the INSERT INTO SELECT statement along with its syntax, examples and use cases.
Read more >How to Use Subqueries in INSERT, UPDATE, and DELETE ...
To prevent this, we add a subquery to the INSERT statement to see if an invoice with the same order_id already exists. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nrcmkoh You can use updateEntity(false) with an insert query builder like this:
Any plans to implement fix resolve this? I’m hitting up against this again, and I don’t want to have to write raw SQL every time I need fast inserts. I feel like the reload negates the performance benefits of using
insert
, especially since it’s creating a select statement for each record.