Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6q8x-0024JN-Ev for pgsql-sql@arkaria.postgresql.org; Tue, 14 May 2024 11:16:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s6q8x-00DDHx-H9 for pgsql-sql@arkaria.postgresql.org; Tue, 14 May 2024 11:16:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6q8x-00DDHp-3S for pgsql-sql@lists.postgresql.org; Tue, 14 May 2024 11:16:27 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s6q8q-0009Mj-Im for pgsql-sql@lists.postgresql.org; Tue, 14 May 2024 11:16:25 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-518931f8d23so5586557e87.3 for ; Tue, 14 May 2024 04:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715685379; x=1716290179; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8IoGter+o4/4Pr1RHD5iBmU1ImrcaZs6FeL0qKEwZE0=; b=Ds4xhfz6kCxG5h83C/y5T4RcIfWh2nuElp2XMJWKocOUpkiHSWWmpm3j0+I8v+HuN3 FiTKA3wEYb6ZtoWmxCKgv0yyAb+QiKZ44MJmuoMp7vu5rBNLmJRFhuIwUF0mIRDI58rH uOfRkQF7cb4Ehl3MnM3ysIED1CMUTzqpnJIHYtn/CKLrbgT/Mb+3TvQrxqlqCoOH8yCD zYqR2HY2FvEqGmCQOcFIekqMHFO/rPKjhF+2K54KLR50CfinJZyqVFVkcNs4vNjewO0V ChmNKleqx2IXRhYy12i8N4YNvITCa8VZH09DzVHCk4R6vyHMWP7A2+DyAjEiD72BjFOV oG6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715685379; x=1716290179; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8IoGter+o4/4Pr1RHD5iBmU1ImrcaZs6FeL0qKEwZE0=; b=q1w9DTdaEkcX0IWyhVITkG6cKD0k9PA7ovhzLSFUr79UezaDcMF61DJuFZuuaIazeq JFBiDyiUgy/N8Kn8YLn5W2z6uFK3Xm/qkmfFoS6X990qBtICZDamKiyTEZG3Wl6ypQkN EZpwFWvFf07rZmV4VqJUbkQd8C9CWHRG0Pge/VZQSI/5gtgpMXi71uViLFa/91zdUIHf ufaLqdSxQweo3+zlbBWtw0++5VVVZjS/QaW4vyUyDkwYQi58Zl7XdzVvDexQc8P2fUcN w500e4ufMqIUYNGeQgvxQiK6xYDcaAAm7iCgTIvKyam9FAXDmHBWbzUscYTqijULegVp +l9A== X-Gm-Message-State: AOJu0Yzq3qpyFlu2dTjUNwB5h7Yy+Tl02nIABms3dQxm+I3PGGKpt/Jl xK0PF1QfjKxe4BLxjqKpk6gtOWuyYjQYsdT//7uSNi5pK8TZX4wXLWSssVwJBVFvw0UNwf+zkzI sDEZVeS+eq1kFGa+Pk8Qbk4hz0gQQGg== X-Google-Smtp-Source: AGHT+IH8f17WLXJwzLUH2ELvYZdKvn8Nl1sA96im+i+1aSQmwlDrXBYUelUNYuQftsImLHhI9plwmg/YgMnx/zN+J24= X-Received: by 2002:a19:ca47:0:b0:51e:fa8c:47cc with SMTP id 2adb3069b0e04-5220fc7ef13mr7918552e87.30.1715685378729; Tue, 14 May 2024 04:16:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Tue, 14 May 2024 23:16:05 +1200 Message-ID: Subject: Re: Small table selection extremely slow! To: Bo Guo Cc: pgsql-sql@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 14 May 2024 at 23:12, Bo Guo wrote: > The following query took 20 seconds on a small table of 108 rows with a dozen columns: > > SELECT * FROM azgiv.layers; > > EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM azgiv.layers; > Seq Scan on layers (cost=0.00..14.00 rows=200 width=233) (actual time=0.010..0.087 rows=200 loops=1) > Buffers: shared hit=12 > Planning: > Buffers: shared hit=51 > Planning Time: 0.233 ms > Execution Time: 0.121 ms One difference between the SELECT and EXPLAIN ANALYZE is that SELECT will detoast your toasted datums whereas EXPLAIN ANALYZE will not. It's likely the slowness comes from the detoasting. David