- 전체
- Sample DB
- database modeling
- [표준 SQL] Standard SQL
- G-SQL
- 10-Min
- ORACLE
- MS SQLserver
- MySQL
- SQLite
- postgreSQL
- 데이터아키텍처전문가 - 국가공인자격
- 데이터 분석 전문가 [ADP]
- [국가공인] SQL 개발자/전문가
- NoSQL
- hadoop
- hadoop eco system
- big data (빅데이터)
- stat(통계) R 언어
- XML DB & XQuery
- spark
- DataBase Tool
- 데이터분석 & 데이터사이언스
- Engineer Quality Management
- [기계학습] machine learning
- 데이터 수집 및 전처리
- 국가기술자격 빅데이터분석기사
- 암호화폐 (비트코인, cryptocurrency, bitcoin)
ORACLE [몽고디비 mongodb] 몽고디비에서 벌크 오퍼려이션과 배열 삽입의 차이점은 what is the difference between bulk insert and array insert in Mongo db operations
2020.10.09 22:01
[몽고디비 mongodb] 몽고디비에서 벌크 오퍼려이션과 배열 삽입의 차이점은
what is the difference between bulk insert and array insert in Mongo db operations
Questuion [질문] =================================================
I am wondering how following queries varies in performance. I understand that bulk insert executes in sequence and normal/array inserts also executes in sequence.
BULK INSERT
var bulk = db.items.initializeUnorderedBulkOp();
bulk.insert( { _id: 1, item: "abc123", status: "A", soldQty: 5000 } );
bulk.insert( { _id: 2, item: "abc456", status: "A", soldQty: 150 } );
bulk.insert( { _id: 3, item: "abc789", status: "P", soldQty: 0 } );
bulk.execute( { w: "majority", wtimeout: 5000 } );
Normal INSERT
db.items.insert( { _id: 1, item: "abc123", status: "A", soldQty: 5000 } );
db.items.insert( { _id: 2, item: "abc456", status: "A", soldQty: 150 } );
db.items.insert( { _id: 3, item: "abc789", status: "P", soldQty: 0 } );
Array INSERT
var array_insert = [
{ _id: 1, item: "abc123", status: "A", soldQty: 5000 } ,
{ _id: 2, item: "abc456", status: "A", soldQty: 150 } ,
{ _id: 3, item: "abc789", status: "P", soldQty: 0 }
] ;
db.items.insert( array_insert );
Can any one explain what is the difference interms of performance or benefits for the above queries ?
Answer[답변] =============================================================
Bulk insert is faster because inserts are sent all at once. Compare it to the regular flow where you send one insert, wait for server reply and only then send next insert.
It takes server the same amount of work to insert all the things, regardless of the mode (bulk vs. regular). In regular mode time is lost on client while it waits for server to respond. Not necessarily because server is slow. Network may be slow too.
Batching requests is a common way of speeding up application, regardless of the database used. See, for example, pipelining in Redis.
[출처] https://stackoverrun.com/ko/q/8347056
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 공지 | 오라클 기본 샘플 데이터베이스 | 졸리운_곰 | 2014.01.02 | 94811 |
| 공지 | [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE | 가을의 곰을... | 2013.02.10 | 85855 |
| 공지 | [G_SQL] Sample Database | 가을의 곰을... | 2012.05.20 | 102674 |
| 9 |
[Sample DB] DBeaver 데이터 dump(export)/restore(import) 방법
| 졸리운_곰 | 2024.07.08 | 2511 |
| 8 |
W3Schools sample Database sql dump
| 졸리운_곰 | 2020.05.16 | 1995 |
| 7 |
다운타임 없는 서비스 구현 패턴
| 졸리운_곰 | 2017.07.15 | 2229 |
| 6 |
[칼퇴족 김대리는 알고 나만 모르는 SQL 예제, mysql 변경 Sample DB SQL 책밥 출판
| 졸리운_곰 | 2017.04.04 | 2072 |
| 5 | [칼퇴족 김대리는 알고 나만 모르는 SQL 예제, Oracle Sample DB SQL 책밥 출판 | 졸리운_곰 | 2017.04.04 | 1902 |
| 4 | SQL Style Guide ; SQL 코딩 표준 | 졸리운_곰 | 2017.01.14 | 30982 |
| 3 |
SQL 기초 sample.pdf
| 졸리운_곰 | 2016.03.16 | 2117 |
| 2 | Select와 동시에 Delete 하기. | 졸리운_곰 | 2016.03.16 | 3222 |
| 1 |
SQL Explorer : Eclipse를 위한 RDMS 쿼리 도구
| 가을의 곰을... | 2013.11.27 | 2490 |

