Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbK3K-00077o-21 for pgsql-general@arkaria.postgresql.org; Tue, 27 Apr 2021 09:30:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lbK3J-0003jz-00 for pgsql-general@arkaria.postgresql.org; Tue, 27 Apr 2021 09:30:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbK3I-0003js-P2 for pgsql-general@lists.postgresql.org; Tue, 27 Apr 2021 09:30:44 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lbK3C-000297-FP for pgsql-general@lists.postgresql.org; Tue, 27 Apr 2021 09:30:43 +0000 Received: by mail-ed1-x534.google.com with SMTP id d14so5302873edc.12 for ; Tue, 27 Apr 2021 02:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=5G1FP9rGW8NTdzQqsFqYktpolK837VjU4Os8Ciy/uQc=; b=VXEyNPQQPXmf63NqDbcgirCTQspmehsz5HsVWuDZ7msD2TngdPraZtpAQM5/AGRVCH CynzRlp0ClAFkodA/XfmrlpJyOYXba2oX1g/rW+rUq9b5z++0A4AtSnEdphnkkJqcyn3 XpjqRc0KsRHUNmM1t6sRiZNeXbOIG6BD3vb1T8bVM06HJJBiHcz5MzBIgbEA1B3/ZuD4 MF0Nc/bqU7mvYxtWHygeVKh1whndFtOcevk67oWqcbt1g44Nv7D/C3jrz6w1w59+SJTb 1iWamhX6BicFm1YQfYHI+3VxSe4iSfbKb2YjplPDl/8ilF3NxqxJhlZzf+6ldIxJYanb kuWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=5G1FP9rGW8NTdzQqsFqYktpolK837VjU4Os8Ciy/uQc=; b=r7md/5C0CqLW4X9FbM6autu7JjGDyVky84UHX0eZoue/C8VAlMiYoYQsrsT5DEfGYI 602nuDnDmA5l6sVSCJArhX4GJ1EIEom4T8sVbmuz8KWpEuDBx+/LjKOqHD+07iR+PARH 42JOUXMd5l/4h/VvKu7I5QQyA2Gryc5XO4FzDRKIDihOGREx1ffVNPRlSw2uxieGJ2MS 6nUgeNWkaNATAZTjO7Is/ErQDWk8NWVq7FR9ICybolgsA/eJBzpgsPKiZgVrdBfsSCpr D67yGqViOWoNGZscz9q15OgL2bFx9OYwYwxYU7WpAlnbSNW6GdiqCvh9NdV9P/+dAEgY 4jRQ== X-Gm-Message-State: AOAM530RL6JkQuJ2/w74NgI3s7V7Pz6lxyipntEYwqgcUTwCJ2l0rOgu SsSH9d6IvxuPdSLpEsYjampQVA== X-Google-Smtp-Source: ABdhPJx2ftQGx2vBP1nt19k/PT5z1pRUlJQZX+WRelhPMOF+pjRIWBXeQXiXgl13u64ERAQSFCO0pQ== X-Received: by 2002:aa7:c2cc:: with SMTP id m12mr3192608edp.1.1619515837077; Tue, 27 Apr 2021 02:30:37 -0700 (PDT) Received: from localhost.localdomain (217-149-166-173.nat.highway.telekom.at. [217.149.166.173]) by smtp.gmail.com with ESMTPSA id c12sm13553943eja.12.2021.04.27.02.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Apr 2021 02:30:36 -0700 (PDT) Message-ID: <93c44e419911beb7ba28ab5f75f2fc113273e643.camel@cybertec.at> Subject: Re: Temporary files usage in explain From: Laurenz Albe To: Matteo Bonardi , pgsql-general@lists.postgresql.org Date: Tue, 27 Apr 2021 11:30:36 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2021-04-27 at 11:15 +0200, Matteo Bonardi wrote: > I have a query that creates a large number of temporary files, in this example ~ 45GB. > Looking at the query plan I can't figure out where temporary files are being generated. > > Explain plan: https://explain.depesz.com/s/BXGT > > Usually I'm looking for "external merge Disk" to see temp files usage but, in this case, the only reference to that is 299,368kB in the last but one node of explain. > Can anyone help me understand where the 45GB are in that explain? I see at first glance: Sort Method: external merge Disk: 299,368kB To see all, use EXPLAIN (ANALYZE, BUFFERS). Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com