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 1t9Apx-008CB8-Ne for pgsql-performance@arkaria.postgresql.org; Thu, 07 Nov 2024 22:18:45 +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 1t9Apu-003CYD-1Z for pgsql-performance@arkaria.postgresql.org; Thu, 07 Nov 2024 22:18:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9Apt-003CY3-NH for pgsql-performance@lists.postgresql.org; Thu, 07 Nov 2024 22:18:42 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t9Apl-000kAO-MW for pgsql-performance@lists.postgresql.org; Thu, 07 Nov 2024 22:18:41 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539f4d8ef84so1807826e87.0 for ; Thu, 07 Nov 2024 14:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731017914; x=1731622714; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zdwaAFoF11VsuIl0q45Kb5qlviVYq2xm3LWdJvWuyLA=; b=OgCXXCuycx3bbMTzDtNNCLAmJI8BZT9S7m8NEX+sMqNdYzH17gS3RWBCCtYpyOGRJI ow65lJimjxmgHT+E9b0wILCDZumpKnwxYAgvjNqQbeN5LS715g0fHQRzzQ0oe76DVxfO HGqcFhGlvqsMCu62KjPkCMIUqwSo2lhgw76ZR3YQo4gUvATfF3pmHszsUa0nmjiKpTFJ tPltRlyy4nWi822ziFd9FF4Fo2PtL50Oye+YzQRj6cO0ak56drExBTA3XhlzxXeQMhHr gkxjpYI0sWdKapV7vWAQ6ufKF9O/vjCgR8H4FZSMDnBBTl3nelUjXvSeMIPvQ9seLIQl gjNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731017914; x=1731622714; h=content-transfer-encoding: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=zdwaAFoF11VsuIl0q45Kb5qlviVYq2xm3LWdJvWuyLA=; b=t85hQDktwiSsTaRVDoQuN0DVg5c6PuavjbpXy/VHLMVWJIvQRPDtgBQoCeDfSm7I3M WETsiDF20fDPnDBvvLXfYMpJ9Qu0dntUo35qM2ZMKmdXF9EYhg+oTfFyrHFI4tu2C+rZ kAPwVjXyVbIZBa3eaZr2OvNwXMfnLA67Jlx9LrB2/jroGfij9DmAieMFx6kvKyH3cgiP j8WUl++9vnXSpKAuwY5jI1BaOTxhw8JAC8s8n85bc4cBaZe+x63NusoMu9A2cgKvMqwA 7Przv3mTPcmXsZaGtr0aWv8w/43CBZHzVtJLfLDRH9k4PcqdWRt0XMrXGppjA67s+Z66 re7g== X-Gm-Message-State: AOJu0Yy10Dzovfw/GS0dHUsvu3v178hMesJTd2W/l+CUG8cvBiGNo25m I38n0egY103B8Wdaf0O29tRNiCdF6ErsjDdoZXmY69zZaWUo1Ss7vvj3qSqUGvdr0xu39Jpzft9 7QVY0RGiWDnkz/dPVHQPfsuu2nnE3lfH2 X-Google-Smtp-Source: AGHT+IE1mFKtbLGQHR2INM5t9JvD9FnUQkxgn+KMa47/InoGyRrmBYG86u58GsZzCtxaHKlPh2L/hqlX+axUmItTSgg= X-Received: by 2002:a05:6512:b9b:b0:539:f7de:df84 with SMTP id 2adb3069b0e04-53d86228b43mr331493e87.10.1731017913242; Thu, 07 Nov 2024 14:18:33 -0800 (PST) MIME-Version: 1.0 References: <197E1EF0-BEDF-42C0-8508-56BC6E88AA35@gmail.com> In-Reply-To: <197E1EF0-BEDF-42C0-8508-56BC6E88AA35@gmail.com> From: David Rowley Date: Fri, 8 Nov 2024 11:18:21 +1300 Message-ID: Subject: Re: Major performance degradation with joins in 15.8 or 15.7? To: Ed Sabol Cc: pgsql-performance@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 8 Nov 2024 at 10:54, Ed Sabol wrote: > The good news is that, after some research and experimentation, I was abl= e to fix this performance degradation by setting random_page_cost =3D 2.0. = We've always used the default values for seq_page_cost and random_page_cost= (1.0 and 4.0, respectively, I think?). A lot of the advice I found online = suggested these *_page_cost settings are too high? Often people lower random_page_cost when running SSDs. The default value of 4.0 was determined before SSDs were a thing. > Did upgrading PostgreSQL to 15.8 cause this performance degradation? Did = the page costs calculation change in 15.8 (or 15.7)? The PostgreSQL version= is the only thing that has appreciably changed with this database this who= le year. It's impossible to say with the given information. You didn't mention which version you upgraded from to start with. We'd need to see EXPLAIN ANALYZE from before and after you changed random_page_cost. > Or do you think the size of the table just incrementally reached some thr= eshold that resulted in the optimizer changing its plan based on the page c= osts? It's possible, but it's also impossible to know without having more informa= tion. > All of the columns are text fields and indexed. Unfortunately, I don't ha= ve the "EXPLAIN (ANALYZE, BUFFERS)" output from before I changed the random= _page_cost setting. It's no longer in my scollback buffer. You can set random_page_cost for just the session you're connected to and try it. SET random_page_cost =3D ; before running EXPLAIN (ANALYZE, BUFFERS). David