yeriimii
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 스터디 일자 - 2024.11.10 일요일 # 참여한 사람 - 옐리 # 11.5 INSERT ## OX 문제 ### INSERT IGNORE 1. 레코드 중복 체크를 통해 중복되는 레코드는 무시하고 INSERT 를 수행한다. ( X ) 2. 데이터 타입이 일치하지 않는 레코드에 대해선 해당 컬럼의 기본값으로 INSERT 를 수행한다. ( O ) ### INSERT ... ON DUPLICATE KEY UPDATE 3. 기존 레코드를 삭제하지 않고 컬럼을 UPDATE 한다. ( O ) ### 성능을 위한 테이블 구조 4. 대량 INSERT 속도는 INSERT 될 레코드들이 사전에 PK 기준으로 정렬된 것과 상관없다. ( X ) => 메모리에 B-Tree를 올려야하는데, 만약 정렬되지 않은 레코들을 디스크에 쓰려면 프라이머리 키 값이 들어가야 할 페이지를 여러 번 찾는 작업이 필요해짐. => 그래서 PK 기준으로 정렬이 되어 있다면, 페이지를 찾는 탐색 작업이 줄어 듭니다. 그래서 빨라집니다. 5. 테이블의 세컨더리 인덱스가 많을수록, 테이블이 클수록 INSERT 성능이 떨어진다. ( O ) => 세컨더리 인덱스의 리프 노드에는 프라이머리 키 값이 있는데, 세컨더리 인덱스가 많을수록 각 세컨더리 인덱스의 리프 노드에 프라이머리 키 값을 넣어줘야하기 때문에 INSERT 성능이 떨어집니다. 6. 로그를 저장하는 테이블의 경우 프라이머리 키는 단조 증가(또는 감소) 패턴이 좋은데, 그 이유는 '읽기(READ)' 성능 때문이다. ( X ) => '쓰기(WRITE)' 성능 때문입니다. => 단조 증가(또는 감소)하면 값이 들어갈 페이지 탐색을 적게하기 때문입니다. (B-Tree) # 11.6 UPDATE & DELETE 1. UPDATE ... ORDER BY ... LIMIT n 을 사용할 땐 중복된 값의 순서에 따라 결과가 달라질 수 있다. ( O ) => 그렇기 때문에 소스-레플리카 복제 구조에서는 사용할 때 주의해야 합니다. (ROW 형태로 복제하는 경우에는 괜찮습니다.) 2. JOIN UPDATE 는 두 개 이상의 테이블을 조인하기 때문에 조인 순서에 따라 성능이 달라질 수 있다. ( O ) 3. JOIN UPDATE 을 빈번히 사용할 때 `데드락`이 발생할 가능성이 높아집니다. 이유가 무엇일까요? - 조인된 모든 테이블에 대해 읽기 참조되는 테이블은 읽기 잠금, 컬럼이 변경되는 테이블은 쓰기 잠금이 걸리기 때문 # 11.7 스키마 조작(DDL) 1. 세컨더리 인덱스를 삭제할 때 잠금이 필요하다. ( X ) => 프라이머리 키 인덱스는 읽기 잠금이 필요합니다. (SHARED LOCK) => 세컨더리 인덱스 삭제는 쉽다. 그런데, 생성할 때 시간이 오래 걸릴 수 있고, 삭제됐을 때 기존에 사용하던 인덱스를 이용하지 못하는 쿼리가 발생할 수 있습니다. => 그래서 삭제 전에는 '가시성'을 이용해서 테스트해보는 것이 좋습니다. => 인덱스에 (INVISIBLE / VISIBLE)을 설정해서 인덱스가 있어도, 없는 것처럼 / 인덱스가 없어도 있는 것처럼 해서 실행계획을 볼 수 있습니다. 2. 둘 이상의 인덱스는 한 번에 생성하게 하는게 각각 나눠서 생성하는 것보다 훨씬 빠르다. ( O ) => 이유는 인덱스를 생성하기 전에 풀 스캔을 해야하는데, 각각 나눠서 인덱스를 생성하면 풀 스캔을 2번 이상 해야 합니다. 3. 커넥션이 강제 종료되면 그 커넥션에서 처리되고 있던 트랜잭션은 자동으로 롤백된다. ( O ) # 11.8 쿼리 성능 테스트 ## MySQL InnoDB 스토리지 엔진에서 쿼리 성능에 미치는 요소에 해당하는 것을 모두 고르세요 - 운영체제의 캐시 ( X ) - 운영체제의 버퍼 ( X ) - 버퍼 풀 ( O ) (mysql innodb 스토리지 엔진에서 관리하는 캐시) - MySQL 서버와 함께 가동되는 다른 프로그램들 ( O ) - 쿼리 테스트 횟수 ( O ) - 워밍업 상태(어느 정도 캐시/버퍼가 있는 상태) / 콜드 상태(캐시/버퍼가 비워져 있는 상태) => InnoDB 스토리지 엔진은 운영체제의 캐시 / 버퍼를 사용하지 않습니다. Direct I/O => 직접 디스크에서 읽기/쓰기

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully