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 1rhy69-00EM19-KC for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2024 20:42:46 +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 1rhy68-00E9cQ-2o for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2024 20:42:44 +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 1rhy67-00E9cD-Oy for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2024 20:42:44 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rhy64-00391l-1M for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2024 20:42:42 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d109e82bd0so830261fa.3 for ; Wed, 06 Mar 2024 12:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1709757759; x=1710362559; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=hIbq5QN2q3KAQDYYXLE52cL/OKvpVu755uollidfsOQ=; b=P4rIzNRbDBrTuNywU2pCnc7wV0rS5oa8RU79mfT74A+QENNPYLbu0BPcNssQhEmite dhDXfo3lcIy/+KOp/wVrAeJ98+gHDPkjq8cjqP63Zct5HSPoPRS6hfVfWyZcPbWUJkt1 SWxgx5dQgcld0rwb9hqr+LGwhU2uqRI0widmT0nMBRMpnNEM/qavAkh5OmwGYwmM1rHE WM2GDz3w7/biY0+hntH8QL4DCWqBvT1bLFwAiZQmuUBg6TMDCw+BajBFN/Q7RFQyIygA T0EtAV02EYNSEKBNXjj+hOjPrp93YVC5VtB6Kxmj5KgYD90m25nUhSfk9fjAeOLfpXBa G5jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709757759; x=1710362559; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hIbq5QN2q3KAQDYYXLE52cL/OKvpVu755uollidfsOQ=; b=GKtAWb8qJ3Esh9XR0vdmpFI+hPvn7GO8lxJaP6VLtYQBJ5L2ZEE4lSVFKUIOLn4A6q B9QywZpA8CsNjCQqOce4mjKHcxBTt8U13RMca67ILa1v1313wA5tTiyIK9uQ+WBK4fSU JU6mCJqz84NVdr42NLLDDPARgypB8Ih7dI0Pv54jkJYQtLIArGfQifTH4E2Mh4ILK+qb CrFlI//Fv4pmL2Kct/EhiwNTt+46bncupqOAgrm4DCWUr5QiU0UopA4QEqyWlVScrG1j P1U7kNe+9HMN2CBqLRonipeQoI0UEzChOnacFaPY+ccbeGxxY3eWYSL0HoSLkugak6Au LNXQ== X-Forwarded-Encrypted: i=1; AJvYcCUPgr87T+sD1OHtgSOFQCD+2ksjzMQVFY0GQV+N4R+NKYPeEpLJg8vTdB8rgw+Ib5R/tuUKEwGtyZhiKSH2/qxtMfg9cXORyQ1uMRmtxmwWXefR X-Gm-Message-State: AOJu0YzaNj29rvGMQo0QLYoVdrNTMU7XQ6UvskmqMEpK34cRnUecuZ2f nT+/YNj1weNxCr8oAfabeli+KTa7MoAdxc0MiXJcADbG40eYcVEM+O4knQASGwBCLWI5UXi4CXo = X-Google-Smtp-Source: AGHT+IGUo+f+RL32RZefyRtrb7fFLeVB5Trod4Hak5GYeHhBuyjB7S8n7Jhb5997Rmg8NF9uTn7w1w== X-Received: by 2002:a2e:9108:0:b0:2d2:bdc2:2f51 with SMTP id m8-20020a2e9108000000b002d2bdc22f51mr98920ljg.1.1709757759025; Wed, 06 Mar 2024 12:42:39 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-225-124.bb.vodafone.cz. [86.49.225.124]) by smtp.gmail.com with ESMTPSA id j29-20020a508a9d000000b0056636a98652sm7611784edj.82.2024.03.06.12.42.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Mar 2024 12:42:38 -0800 (PST) Message-ID: <6feca2da-4818-466f-9374-5cef5bb85383@enterprisedb.com> Date: Wed, 6 Mar 2024 21:42:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Shared detoast Datum proposal Content-Language: en-US To: Nikita Malakhov , Andy Fan Cc: Michael Zhilin , Peter Smith , vignesh C , Matthias van de Meent , pgsql-hackers@lists.postgresql.org References: <87il4jrk1l.fsf@163.com> <87v87kvboq.fsf@163.com> <71321d83-391b-473b-aaf6-618c7f682b96@postgrespro.ru> <87r0i7vos3.fsf@163.com> <874je3hcwn.fsf@163.com> <8734tmg88e.fsf@163.com> <7f4c8673-4c5d-4dbf-b8e5-0ec11cd2fba0@enterprisedb.com> <87h6i2djf9.fsf@163.com> <87jzms0xza.fsf@163.com> <87frxf1gld.fsf@163.com> <875xyb1a6q.fsf@163.com> <87zfvedbsr.fsf@163.com> <87y1axc1o1.fsf@163.com> <05aca065-f1f1-48af-b0e8-5eaa72ee6b6f@enterprisedb.com> <87ttllbd00.fsf@163.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/6/24 07:09, Nikita Malakhov wrote: > Hi, > > In addition to the previous message - for the toast_fetch_datum_slice > the first (seems obvious) way is to detoast the whole value, save it > to cache and get slices from it on demand. I have another one on my > mind, but have to play with it first. > What if you only need the first slice? In that case decoding everything will be a clear regression. IMHO this needs to work like this: 1) check if the cache already has sufficiently large slice detoasted (and use the cached value if yes) 2) if there's no slice detoasted, or if it's too small, detoast a sufficiently large slice and store it in the cache (possibly evicting the already detoasted slice) regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company