Search

DELETE FROM vs. TRUNCATE

โ€ข
DELETE FROM table_name (not DELETE * FROM)
โ—ฆ
ํ…Œ์ด๋ธ”์—์„œ ๋ชจ๋“  ๋ ˆ์ฝ”๋“œ๋ฅผ ์‚ญ์ œ
โ—ฆ
vs. DROP TABLE table_name
โ—ฆ
WHERE ์‚ฌ์šฉํ•ด ํŠน์ • ๋ ˆ์ฝ”๋“œ๋งŒ ์‚ญ์ œ ๊ฐ€๋Šฅ:
โ–ช
DELETE FROM raw_data.user_session_channel WHERE channel = โ€˜Googleโ€™
โ€ข
TRUNCATE table_name๋„ ํ…Œ์ด๋ธ”์—์„œ ๋ชจ๋“  ๋ ˆ์ฝ”๋“œ๋ฅผ ์‚ญ์ œ
โ—ฆ
DELETE FROM์€ ์†๋„๊ฐ€ ๋Š๋ฆผ
โ—ฆ
TRUNCATE์ด ์ „์ฒด ํ…Œ์ด๋ธ”์˜ ๋‚ด์šฉ ์‚ญ์ œ์‹œ์—๋Š” ์—ฌ๋Ÿฌ๋ชจ๋กœ ์œ ๋ฆฌ
โ—ฆ
ํ•˜์ง€๋งŒ ๋‘๊ฐ€์ง€ ๋‹จ์ ์ด ์กด์žฌ
โ–ช
TRUNCATE๋Š” WHERE์„ ์ง€์›ํ•˜์ง€ ์•Š์Œ
โ–ช
TRUNCATE๋Š” Transaction์„ ์ง€์›ํ•˜์ง€ ์•Š์Œ