Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿš€ [feature] ๋ธŒ๋ฆฌํ•‘ ๋ชฉ๋ก ์กฐํšŒ V2 ์ฟผ๋ฆฌ ํŠœ๋‹ #160

Closed
swa07016 opened this issue Jan 12, 2024 · 0 comments ยท Fixed by #208
Assignees
Labels
โœจ feature New feature or request

Comments

@swa07016
Copy link
Member

๐Ÿค– ๊ธฐ๋Šฅ ๊ฐœ์š”

๋ธŒ๋ฆฌํ•‘ ๋ชฉ๋ก ์กฐํšŒ V2 ์ฟผ๋ฆฌ๋ฅผ ํŠœ๋‹ํ•ฉ๋‹ˆ๋‹ค.

  • ํ˜„์žฌ ์‹คํ–‰ ๊ณ„ํš ๊ฒฐ๊ณผ
{
    "id": 1,
    "select_type": "SIMPLE",
    "table": "b",
    "partitions": null,
    "type": "ALL",
    "possible_keys": "idx_briefing_id",
    "key": null,
    "key_len": null,
    "ref": null,
    "rows": 1966,
    "filtered": 10,
    "Extra": "Using where; Using temporary; Using filesort"
  }
- ํ…Œ์ด๋ธ” Full Scan์„ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
- ์˜ตํ‹ฐ๋งˆ์ด์ €๊ฐ€ 1966๊ฑด (๊ฑฐ์˜ ๋ชจ๋“  ํ–‰)์„ ๊ฒ€์‚ฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
- ๊ฒ€์‚ฌํ•œ ํ–‰๋“ค์ค‘ 10%์ •๋„๋งŒ ์œ ํšจํ•ฉ๋‹ˆ๋‹ค.
  • ์ฟผ๋ฆฌ ์‹คํ–‰ ์†๋„
-> Limit: 20 row(s)  (actual time=7.34..7.35 rows=20 loops=1)
    -> Sort: date_format(b.created_at,'%Y-%m-%d %H') DESC, b.ranks, limit input to 20 row(s) per chunk  (actual time=7.34..7.35 rows=20 loops=1)
        -> Table scan on <temporary>  (actual time=7.05..7.15 rows=388 loops=1)
            -> Aggregate using temporary table  (actual time=7.05..7.05 rows=388 loops=1)
                -> Nested loop left join  (cost=319 rows=230) (actual time=0.767..3.28 rows=397 loops=1)
                    -> Filter: (b.`type` = 'SOCIAL')  (cost=246 rows=197) (actual time=0.752..2.7 rows=388 loops=1)
                        -> Table scan on b  (cost=246 rows=1966) (actual time=0.0257..2.42 rows=2163 loops=1)
                    -> Covering index lookup on s using FK48tasjrnowinupvg2usjq2y9u (briefing_id=b.id)  (cost=0.251 rows=1.17) (actual time=0.00116..0.00127 rows=0.0902 loops=388)

์ง€๊ธˆ์€ ๋ฐ์ดํ„ฐ๊ฐ€ ์ ์œผ๋‹ˆ, ์†๋„๊ฐ€ ๊ดœ์ฐฎ์ง€๋งŒ ๋งค์ผ 80๊ฑด์”ฉ ํ…Œ์ด๋ธ”์— ์Œ“์ด๋Š” ์ƒํ™ฉ์—์„œ ๋ฏธ๋ฆฌ ํŠœ๋‹ํ•ด ๋‘˜ ํ•„์š”๊ฐ€ ์žˆ์–ด๋ณด์ž…๋‹ˆ๋‹ค.

๐Ÿ“š Remarks

์ ์ ˆํžˆ ์ธ๋ฑ์Šค๋ฅผ ๋‘์–ด์„œ ํ•ด๊ฒฐํ•  ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
โœจ feature New feature or request
Projects
None yet
1 participant