Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifWJ0-00008L-J2 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Dec 2019 21:47:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ifWIz-0005WJ-DU for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Dec 2019 21:47:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifWIy-0005Su-QI for pgsql-hackers@lists.postgresql.org; Thu, 12 Dec 2019 21:47:29 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ifWIw-0001rm-LJ for pgsql-hackers@postgresql.org; Thu, 12 Dec 2019 21:47:27 +0000 Received: by mail-pl1-x62d.google.com with SMTP id bd4so126949plb.8 for ; Thu, 12 Dec 2019 13:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UkhDkjNSt3Fd4kNU/mqzdBtgRK31vbO7a9nqfYIITrs=; b=uJ9mq6mHCccMibIyU46NElGVFWdnHAsJgqG8jFO7elfOYypgo+T734PsC/DzB2kFJj noTW4LdlJA7BpgzExMwxM3+ce/Tuo564N8Cg457R5Sfu874v9I8JMP8a9ggI9iOkXbKa aRfrqeC8AWmipxFRCZwDEcOVcaSuqKREdqdawYT21Ww6eRpmw2jOGn5PC+YFN40JT4Vl gD01fnBBG35DOmixF2H/KsoKXz1L3kqgh2ZfdzXmySXt9neI9qLknSuE8tVn1PjbAhkT aRHkcqEFpCT0a7ohVhsf7V1BRO3CqvT+CxaO7PsK6taKDPkXFc6sxOnP2Ho1ZeF74h/O N9nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UkhDkjNSt3Fd4kNU/mqzdBtgRK31vbO7a9nqfYIITrs=; b=FlNf+kKAuLi1FnJf1NaNhBKVFVIAsXE/4aMo3k+q53o6o3OkCAaSySdzxQQIVEEgtH apDOyTob7aWTRQCt99NQDsr63A0x0JNkkI/p/krcLErcP5+rNhTroFsYSsT7cKeNqyKg h9gNEtWNUoFNyR+SVongbf5Y/sMsCGXv0l1B1/ZKpgX3po6uKV47fdO8Ikau4ygovmCS 47k+yJePY96cNOnT6bLNQWUItmLT/c2w0mnD0LvIUl9KYGm/7ChAR+MATHsleeLLsfZ7 lwQ2WTpnZ1Xi1dRD8QRfM9RoyNeFkmBBK1lZ5FGppVQTSXkTNTsZkd/aJWwSzOtLrFCP NxcQ== X-Gm-Message-State: APjAAAW78SIbGwFQNhSw9avPI9iL4m3cqbkSKgMW5Zu4ueQ6tATEtTU8 EKDX9YqIQVMUjXx4cxmf7YaK07s5 X-Google-Smtp-Source: APXvYqwl3TSIWQqX8Kjc6GkI+dmU+nlohHlh7sYkLqannWGTwiFavRafdG2Ye3egnVMk+MSYKzPiww== X-Received: by 2002:a17:90a:3ae3:: with SMTP id b90mr12726634pjc.62.1576187245079; Thu, 12 Dec 2019 13:47:25 -0800 (PST) Received: from [192.168.0.17] (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id z10sm8376877pfa.184.2019.12.12.13.47.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Dec 2019 13:47:24 -0800 (PST) Subject: Re: Make autovacuum sort tables in descending order of xid_age From: Mark Dilger To: David Fetter Cc: PostgreSQL Development , Christophe Pettus References: <20191129180138.GD8731@fetter.org> <20191129222152.GE8731@fetter.org> <2488acea-328b-1328-d437-8c156bc8f7a4@gmail.com> <20191130222314.GF8731@fetter.org> <877ac074-e95d-bdee-09e7-c51f0ee0fde2@gmail.com> <20191212192631.GA29201@fetter.org> <2ad2a9fa-32eb-29aa-07ee-f0fe75ad4db5@gmail.com> Message-ID: <49dac8e3-40bc-2986-e873-51f874c0f5fa@gmail.com> Date: Thu, 12 Dec 2019 13:47:23 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <2ad2a9fa-32eb-29aa-07ee-f0fe75ad4db5@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/12/19 1:35 PM, Mark Dilger wrote: >   Let C = 1.00000002065 >   Let x = xid_age for a table >   Let v = clamp(n_dead_tuples / reltuples*2) to max 0.5 >   Let a = clamp(changes_since_analyze / reltuples) to max 0.5 > >   Let score = C**x + v + a I should hasten to add that this is just a proof of concept formula, not one that I'm specifically advocating. The point is that we can devise a scoring system in which the xid age is the dominant factor whenever it could possibly matter, while still letting other factors prevail when xid age is of little consequence. -- Mark Dilger