์„œ๋ธŒ ์ฟผ๋ฆฌ์˜ ์„ฑ๋Šฅ์— ๋Œ€ํ•œ ์˜คํ•ด

2024. 1. 21. 22:18ใ†Database/DB ์Šคํ„ฐ๋””

๊ฐœ์ธ์ ์ธ ๊ฒฝํ—˜ ์ƒ, ์ทจ์—…์„ ์ค€๋น„ํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์ง€๋ง์ƒ ๋ถ„๋“ค์ด๋‚˜ ํ˜น์€ ์‹ ์ž… ๋‚ด์ง€ ์ฃผ๋‹ˆ์–ด ๊ฐœ๋ฐœ์ž ๋ถ„๋“ค ์‚ฌ์ด์—๋Š” ์„œ๋ธŒ ์ฟผ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฐ์ดํ„ฐ์˜ ๊ฒ€์ƒ‰ ์„ฑ๋Šฅ์ด ๋“œ๋ผ๋งˆํ‹ฑํ•˜๊ฒŒ ๋‚˜๋น ์งˆ ๊ฒƒ์ด๋ผ๋Š” ํ†ต๋…์ด ์กด์žฌํ•˜๋Š” ๊ฒƒ ๊ฐ™๋‹ค. 

๋‚˜ ๋˜ํ•œ ๊ทธ๋ ‡๊ฒŒ ์ƒ๊ฐํ•ด์™”์—ˆ๋Š”๋ฐ ์ด๊ฒŒ ์ •๋ง ๋งž๋Š”์ง€, ์•„๋‹ˆ๋ฉด ์˜คํ•ด์ธ ๊ฒƒ์ธ์ง€ ํ™•์ธํ•ด๋ณด๋ คํ•œ๋‹ค.

 

์„œ๋ธŒ ์ฟผ๋ฆฌ๋ž€?

์„œ๋ธŒ ์ฟผ๋ฆฌ๋ž€ ๋ฉ”์ธ ์ฟผ๋ฆฌ๊ฐ€ ์กด์žฌํ•˜๋Š” ์ƒํ™ฉ์—์„œ ๋ฉ”์ธ ์ฟผ๋ฆฌ ๋‚ด์— ํฌํ•จ๋œ ๋˜ ๋‹ค๋ฅธ ์ฟผ๋ฆฌ๋ฅผ ์˜๋ฏธํ•œ๋‹ค.

์–ด๋–ค ์ ˆ์— ํฌํ•จ๋œ ์ฟผ๋ฆฌ์ธ์ง€์— ๋”ฐ๋ผ ์Šค์นผ๋ผ ์„œ๋ธŒ ์ฟผ๋ฆฌ(SELECT ๋ฌธ), ์ธ๋ผ์ธ ๋ทฐ(FROM ์ ˆ), ์„œ๋ธŒ ์ฟผ๋ฆฌ(WHERE ์ ˆ, ๊ทธ๋ƒฅ ์„œ๋ธŒ ์ฟผ๋ฆฌ๋ผ๊ณ  ํ•˜๋Š” ๋“ฏ...) ๋“ฑ์˜ ๋ช…์นญ์œผ๋กœ ๋ถˆ๋ฆฐ๋‹ค.

์•„๋ž˜๋Š” ์„œ๋ธŒ ์ฟผ๋ฆฌ์˜ ์˜ˆ์‹œ์ด๋‹ค.

-- ์Šค์นผ๋ผ ์„œ๋ธŒ ์ฟผ๋ฆฌ
SELECT 
  p.id AS id, 
  (SELECT email FROM account WHERE email = p.account) AS acc_email
FROM post p
WHERE created_at > '2024-01-20'::DATE - interval '1 MONTH';

-- ์ธ๋ผ์ธ ๋ทฐ
SELECT
  p.id AS post_id,
  a.email AS acc_email
FROM 
  account a,
  (SELECT * FROM post WHERE created_at > '2024-01-20'::DATE - interval '1 MONTH') p
WHERE p.account = a.email;

-- ์„œ๋ธŒ ์ฟผ๋ฆฌ (WHERE ์ ˆ)
SELECT *
FROM account
WHERE 
  email IN (SELECT DISTINCT post.account FROM post WHERE created_at > '2024-01-20'::DATE - interval '1 MONTH');

 

์„œ๋ธŒ ์ฟผ๋ฆฌ์˜ ์„ฑ๋Šฅ

์œ„ ์˜ˆ์‹œ์˜ ์„œ๋ธŒ ์ฟผ๋ฆฌ๋ฅผ ๊ธฐ์ค€์œผ๋กœ, ์‹คํ–‰ ๊ณ„ํš๊ณผ ์„ฑ๋Šฅ์ด ์–ด๋–ค์ง€ ํ™•์ธํ•ด๋ณด๊ณ  ํ•ด๋‹น ์ฟผ๋ฆฌ์˜ ๋Œ€์•ˆ์œผ๋กœ ์—ฌ๊ฒจ์ง€๋Š” ์ฟผ๋ฆฌ์˜ ์‹คํ–‰ ๊ณ„ํš๊ณผ ์„ฑ๋Šฅ์„ ๋น„๊ตํ•ด๋ณด๋Š” ์‹์œผ๋กœ ๊ธ€์„ ์ง„ํ–‰ํ•˜๊ฒ ๋‹ค. ์œ„ ์ฟผ๋ฆฌ๋“ค์€ ๋ชจ๋‘ ๋น„์Šทํ•œ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ์ฟผ๋ฆฌ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ€์žฅ ์œ„์— ์ž๋ฆฌํ•˜๊ณ  ์žˆ๋Š” ์Šค์นผ๋ผ ์„œ๋ธŒ ์ฟผ๋ฆฌ์— ๋Œ€ํ•ด์„œ๋งŒ ํ™•์ธํ•ด๋ณด๊ฒ ๋‹ค. ์ด ๋•Œ ํ…Œ์ŠคํŠธ์šฉ DB๋กœ๋Š” PostgreSQL์„ ์‚ฌ์šฉํ•˜์˜€๋‹ค.

ํ…Œ์ŠคํŠธ ์‚ฌ์ „ ์ž‘์—…

ํ•ด๋‹น ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด account ํ…Œ์ด๋ธ”๊ณผ post ํ…Œ์ด๋ธ”์„ ์•„๋ž˜์˜ ์Šคํ‚ค๋งˆ๋กœ ์ƒ์„ฑํ•ด์ฃผ์—ˆ๊ณ , ๊ฐ๊ฐ 5๋งŒ๊ฐœ์™€ 25๋งŒ๊ฐœ์˜ ๋”๋ฏธ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์—ˆ๋‹ค.

CREATE TABLE account (
  email VARCHAR(50) PRIMARY KEY,
  pwd VARCHAR(20) NOT NULL,
  created_at TIMESTAMPTZ NOT NULL
);

CREATE TABLE post (
  id SERIAL PRIMARY KEY,
  account VARCHAR(50) NOT NULL,
  title VARCHAR(30) NOT NULL,
  content VARCHAR NOT NULL,
  created_at TIMESTAMPTZ NOT NULL,
  CONSTRAINT fk_post_account FOREIGN KEY (account) REFERENCES account(email)
);

์„ฑ๋Šฅ ํ™•์ธ

์œ„ ์˜ˆ์‹œ์˜ ์ฟผ๋ฆฌ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

SELECT 
  p.id AS id, 
  (SELECT email FROM account WHERE email = p.account) AS acc_email
FROM post p
WHERE created_at > '2024-01-20'::DATE - interval '1 MONTH';

ํ•ด๋‹น ์ฟผ๋ฆฌ์˜ ์‹คํ–‰ ๊ณ„ํš์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

์‹คํ–‰ ๊ณ„ํš์„ ๋ณด๋ฉด post ํ…Œ์ด๋ธ”์„ ํ’€์Šค์บ”ํ•˜๋ฉด์„œ ์กฐ๊ฑด์ ˆ์— ๋ถ€ํ•ฉํ•˜๋Š” 6๋งŒ์—ฌ๊ฐœ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฐพ๊ณ , ์ด๋“ค์— ๋Œ€ํ•ด ์ผ์ผ์ด account ํ…Œ์ด๋ธ”์˜ ์ธ๋ฑ์Šค๋ฅผ ํ™•์ธํ•˜๋Š” ๋ชจ์Šต์ด๋‹ค. ์„œ๋ธŒ ์ฟผ๋ฆฌ ์ชฝ์˜ 6๋งŒ๊ฑด์˜ loop ๊ฐ’์ด ์ด๋ฅผ ๋งํ•ด์ค€๋‹ค.

๊ทธ๋ ‡๋‹ค๋ฉด ์ด์ œ ์œ„์™€ ๋™์ผํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ์กฐ์ธ ์ฟผ๋ฆฌ๋ฅผ ์‹คํ–‰์‹œ์ผœ๋ณด์ž. ์žฌ๊ตฌ์„ฑํ•œ ์ฟผ๋ฆฌ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

SELECT 
  p.id AS id, 
  a.email AS acc_email
FROM post p
LEFT JOIN account a
  ON a.email = p.account
WHERE p.created_at > '2024-01-20'::DATE - interval '1 MONTH';

ํ•ด๋‹น ์ฟผ๋ฆฌ์˜ ์‹คํ–‰ ๊ณ„ํš์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

์‹คํ–‰ ๊ณ„ํš์„ ๋ณด๋ฉด post ํ…Œ์ด๋ธ”์„ ํ’€์Šค์บ”ํ•˜์—ฌ ์กฐ๊ฑด์— ๋งž๋Š” ๋ฐ์ดํ„ฐ๋“ค์„ ์ฝ๊ณ , account ํ…Œ์ด๋ธ”์„ ๋”ฐ๋กœ ํ’€์Šค์บ”ํ•˜์—ฌ ํ•ด์‹œํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•˜์—ฌ ์ด๋ฅผ ์ด์šฉํ•ด์„œ ์กฐ์ธ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ์žˆ๋‹ค. ์กฐ์ธ์€ ์„ธ์…˜ ๋ณ„ ๋ฉ”๋ชจ๋ฆฌ์— ์ƒ์„ฑํ•œ ํ•ด์‹œํ…Œ์ด๋ธ”์„ ํ†ตํ•ด ์ˆ˜ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฒ„ํผ ์บ์‹œ๋ฅผ ์ฝ๋Š” ๋…ผ๋ฆฌ์  IO๊ฐ€ ํ™•์—ฐํžˆ ์ค„์–ด๋“  ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. (187253ํšŒ -> 5570ํšŒ) ๋˜ํ•œ ์‹ค์ œ ์„ฑ๋Šฅ๋„ ๋งŽ์ด ๊ฐœ์„ ๋˜์—ˆ๋‹ค. (277ms ->101ms)

๊ทธ๋ ‡๋‹ค๋ฉด ํ‘œ๋ณธ์ด ๋‹จ ํ•˜๋‚˜์˜ ์ฟผ๋ฆฌ์ด๊ธด ํ•˜๋‚˜, ๋™์ผํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ์ฟผ๋ฆฌ์— ๋Œ€ํ•ด ์กฐ์ธ ์ฟผ๋ฆฌ๊ฐ€ ํ›จ์”ฌ ์ข‹์€ ์„ฑ๋Šฅ์ด ๋ณด์ด๊ธฐ ๋•Œ๋ฌธ์— ๋Œ€๋ถ€๋ถ„์˜ ๊ฒฝ์šฐ ์กฐ์ธ ์—ฐ์‚ฐ์ด ๋” ๋‚ซ๋‹ค๊ณ  ์ผ๋ฐ˜ํ™”ํ•  ์ˆ˜ ์žˆ์„๊นŒ?

์ด๋Š” ๋ช…๋ฐฑํžˆ ์•„๋‹ˆ๋‹ค. ๋‹ค์‹œ ํ•œ๋ฒˆ ์œ„ ์„œ๋ธŒ ์ฟผ๋ฆฌ์˜ ์‹คํ–‰ ๊ณ„ํš์„ ์‚ดํŽด๋ณด๋ฉด, ๋งค ๋ ˆ์ฝ”๋“œ๋งˆ๋‹ค ์„œ๋ธŒ ์ฟผ๋ฆฌ๊ฐ€ ์‹คํ–‰๋˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋Š”๋ฐ ์ด๋Š” ์‚ฌ์‹ค NL ์กฐ์ธ๊ณผ ๋™์ผํ•˜๊ฒŒ ์ž‘๋™ํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์ด๋‹ค. ์œ„์—์„œ ์‚ดํŽด๋ณธ ๊ฒฝ์šฐ๋Š” 6๋งŒ๊ฑด์ด๋‚˜ ๋˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์˜ตํ‹ฐ๋งˆ์ด์ €๊ฐ€ ํ•ด์‹œ ์กฐ์ธ์„ ์„ ํƒํ–ˆ๊ณ , ์ด๋กœ ์ธํ•ด ์„œ๋ธŒ ์ฟผ๋ฆฌ์˜ ๋น„ํšจ์œจ์ด ์ปค์กŒ์ง€๋งŒ ์˜ตํ‹ฐ๋งˆ์ด์ €๊ฐ€ NL ์กฐ์ธ์„ ์„ ํƒํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ๋‘ ์ฟผ๋ฆฌ๊ฐ€ ์œ ์‚ฌํ•œ ์„ฑ๋Šฅ์„ ๋ณด์ผ ๊ฐ€๋Šฅ์„ฑ์ด ํฌ๋‹ค.

์ด ๊ฒฝ์šฐ๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์œ„ ์ฟผ๋ฆฌ๋ฅผ ์•„๋ž˜์ฒ˜๋Ÿผ ์ˆ˜์ •ํ•œ ๋’ค ๋‹ค์‹œ ํ•œ๋ฒˆ ์‹คํ–‰ ๊ณ„ํš์„ ํ™•์ธํ•ด๋ณด์ž.

SELECT 
  p.id AS id, 
  (SELECT email FROM account WHERE email = p.account) AS acc_email
FROM post p
WHERE created_at > '2024-01-20'::DATE - interval '6 HOUR';

SELECT 
  p.id AS id, 
  a.email AS acc_email
FROM post p
LEFT JOIN account a
  ON a.email = p.account
WHERE p.created_at > '2024-01-20'::DATE - interval '6 HOUR';

๋‘ ์ฟผ๋ฆฌ์˜ ์‹คํ–‰ ๊ณ„ํš์€ ๊ฐ๊ฐ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

์Šค์นผ๋ผ ์„œ๋ธŒ ์ฟผ๋ฆฌ ์‹คํ–‰ ๊ณ„ํš
์กฐ์ธ ์ฟผ๋ฆฌ ์‹คํ–‰ ๊ณ„ํš

๋‘ ์ฟผ๋ฆฌ์˜ ์‹คํ–‰ ๊ณ„ํš์„ ๋น„๊ตํ•ด๋ณด๋ฉด, ๊ณ„์ธต ๊ตฌ์กฐ๊ฐ€ ์กฐ๊ธˆ ๋‹ค๋ฅด๊ฒŒ ๋ณด์ผ ์ˆ˜๋„ ์žˆ์œผ๋‚˜ ๊ฒฐ๊ตญ์€ ๊ฑฐ์˜ ๋™์ผํ•˜๊ฒŒ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ๋”ฐ๋ผ์„œ NL ์กฐ์ธ์œผ๋กœ ์‹คํ–‰๋˜๋Š” ์กฐ์ธ ์ฟผ๋ฆฌ๋ผ๋ฉด ๋‘ ์ฟผ๋ฆฌ์˜ ์„ฑ๋Šฅ์„ ๋น„์Šทํ•˜๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ๋‹ค. 

 

๊ฒฐ๋ก 

๊ฒฐ๋ก ๋งŒ ๋†“๊ณ  ๋ณด์ž๋ฉด, ๊ฒฐ๊ตญ ๋™์ผํ•œ ์ฟผ๋ฆฌ๋ผ๋ฉด ์กฐ์ธ๋ฌธ์œผ๋กœ ์ž‘์„ฑ or ์œ ๋„๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ์„ฑ๋Šฅ ์ƒ ์ฐจ์„ ์„ ๋ณด์žฅํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์•„๋‹ˆ๋ƒ๊ณ  ํ•  ์ˆ˜ ์žˆ๊ณ , ์ด๋Š” ํƒ€๋‹นํ•ด๋ณด์ธ๋‹ค. ํ•˜์ง€๋งŒ ์˜คํ•ดํ•˜์ง€ ๋ง์•„์•ผ ํ•  ์ ์€ ์ด ๊ฒฝ์šฐ ์„œ๋ธŒ ์ฟผ๋ฆฌ๋ผ์„œ ๋Š๋ฆฐ ๊ฒƒ์ด ์•„๋‹ˆ๋ผ NL ์กฐ์ธ์ด์—ฌ์„œ ๋Š๋ฆฐ ๊ฒƒ์ด๋‹ค. NL ์กฐ์ธ์€ ์กฐํšŒํ•ด์•ผ ํ•  ๋ฐ์ดํ„ฐ๊ฐ€ ๋งŽ์€ ๊ฒฝ์šฐ ์„ฑ๋Šฅ ์ƒ ๋ถˆ์ด์ต์ด ๋ฐœ์ƒํ•˜๋Š” ๊ตฌ์กฐ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ž์—ฐ์ ์œผ๋กœ ๋ฐœ์ƒํ•˜๋Š” ์„ฑ๋Šฅ ์ €ํ•˜์ด๊ณ , ์˜ตํ‹ฐ๋งˆ์ด์ €๊ฐ€ ์„œ๋ธŒ ์ฟผ๋ฆฌ๋ฅผ unnest ์ฒ˜๋ฆฌํ•˜์—ฌ ๋‹ค๋ฅธ ์กฐ์ธ ๋ฐฉ์‹์œผ๋กœ ํ’€์ง€ ์•Š๋Š” ์ด์ƒ NL ์กฐ์ธ์˜ ๊ตฌ์กฐ๋ฅผ ํƒˆํ”ผํ•˜๋Š” ๊ฒƒ์€ ์–ด๋ ต๋‹ค.

๊ฒฐ๋ก ์ด ์ข€ ๊ธธ์–ด์กŒ๋Š”๋ฐ, ํ•˜๊ณ  ์‹ถ์€ ์ด์•ผ๊ธฐ๋Š” ๊ฒฐ๊ตญ ์™œ ์„œ๋ธŒ ์ฟผ๋ฆฌ๊ฐ€ ์„ฑ๋Šฅ์ด ๋” ์•ˆ์ข‹์€ ๊ฒƒ์ธ์ง€ ์ œ๋Œ€๋กœ ํŒŒ์•…ํ•˜์ง€ ์•Š๊ณ  ๋ฌด์กฐ๊ฑด ์„œ๋ธŒ ์ฟผ๋ฆฌ๋ผ์„œ ์•ˆ์ข‹๋‹ค๋Š” ๊ฒƒ์€ ๊ทธ ์‚ฌ๋žŒ์˜ ์ฐฉ๊ฐ์ด๋ผ๋Š” ๊ฒƒ์ด๋‹ค. ์ด๊ฑด ๊ฒฐ๊ตญ ๊นŒ๋†“๊ณ  ๋ณด๋ฉด NL ์กฐ์ธ์€ ํ•ด์‹œ ์กฐ์ธ๋ณด๋‹ค ํ•ญ์ƒ ์„ฑ๋Šฅ์ด ์•ˆ์ข‹๋‹ค! ๋ผ๊ณ  ๋งํ•˜๋Š” ๊ฒƒ๊ณผ ๋‹ค๋ฅด์ง€ ์•Š๋‹ค.

 

์—ฌ๋‹ด

์˜ค๋ผํด์—๋Š” ์Šค์นผ๋ผ ์„œ๋ธŒ ์ฟผ๋ฆฌ ์บ์‹ฑ์ด๋ผ๋Š” ๊ธฐ๋Šฅ์ด ์กด์žฌํ•œ๋‹ค. PGA ์˜์—ญ์— ์Šค์นผ๋ผ ์„œ๋ธŒ ์ฟผ๋ฆฌ์— ๋Œ€ํ•ด input -> output์„ ์บ์‹ฑํ•ด๋‘๊ณ  ๋™์ผํ•œ input์ด ๋“ค์–ด์˜ค๋Š” ๊ฒฝ์šฐ ๋ฒ„ํผ ์บ์‹œ๋ฅผ ์กฐํšŒํ•˜์ง€ ์•Š๊ณ  ๊ณง๋ฐ”๋กœ output์„ ๋„์ถœํ•˜๋Š” ์‹์œผ๋กœ ์ž‘๋™ํ•œ๋‹ค. ๋”ฐ๋ผ์„œ ๋ณธ๋ฌธ์—์„œ ์–ธ๊ธ‰ํ•œ NL ์กฐ์ธ ์˜ˆ์‹œ์˜ ๊ฒฝ์šฐ, ์˜คํžˆ๋ ค ์„œ๋ธŒ ์ฟผ๋ฆฌ ์˜ˆ์ œ๊ฐ€ ์„ฑ๋Šฅ ์ƒ ๋” ๋‚˜์„ ์ˆ˜๋„ ์žˆ๋‹ค. ๋ณธ๋ฌธ์˜ ์˜ˆ์‹œ๋Š” Postgresql์„ ์‚ฌ์šฉํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์— ์ด์—๋„ ์œ ์‚ฌํ•œ ๊ธฐ๋Šฅ์ด ์žˆ๋‚˜ ์ฐพ์•„๋ดค๋Š”๋ฐ, ์ž๋ฃŒ๊ฐ€ ๋งŽ์ด ๋‚˜์˜ค์ง„ ์•Š์•˜์œผ๋‚˜ ์•„๋ž˜ ์•„ํ‹ฐํด์„ ๋ณด๋ฉด ์œ ์‚ฌํ•œ ๊ธฐ๋Šฅ์ด ํ˜„์žฌ๋Š” ์กด์žฌํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ธ๋‹ค.

 

์ปค๋ฎค๋‹ˆํ‹ฐ > ๋‚˜๋งŒ์˜ ๊ฐ•์ขŒ๋ฐ ํŒ > Scalar subquery caching and Memoization1 - All About PostgreSQL

์ด ๊ฒŒ์‹œ๋ฌผ 159๊ฑด, ์ตœ๊ทผ 0 ๊ฑด Scalar subquery caching and Memoization1 ๊ธ€์“ด์ด : ๋ชจ๋ธ๊ด‘ ๋‚ ์งœ : 2022-02-05 (ํ† ) 10:44 ์กฐํšŒ : 1657 In the last article titled Scalar Subquery Optimization I mentioned that some scalar subqueries in PostgreSQL ha

www.postgresdba.com

 

 

์ปค๋ฎค๋‹ˆํ‹ฐ > ๋‚˜๋งŒ์˜ ๊ฐ•์ขŒ๋ฐ ํŒ > Scalar subquery caching and Memoization2 - All About PostgreSQL

์ด ๊ฒŒ์‹œ๋ฌผ 159๊ฑด, ์ตœ๊ทผ 0 ๊ฑด Scalar subquery caching and Memoization2 ๊ธ€์“ด์ด : ๋ชจ๋ธ๊ด‘ ๋‚ ์งœ : 2022-02-05 (ํ† ) 10:45 ์กฐํšŒ : 1322 As expected the execution plan now tells us that Sort operation completed inside a view called v1; and we can se

www.postgresdba.com