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 1hj65j-0001O1-Ty for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2019 18:04:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hj65i-00014I-Pj for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2019 18:04:18 +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 1hj64H-0005OJ-II for pgsql-hackers@lists.postgresql.org; Thu, 04 Jul 2019 18:02:49 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hj64E-0003cj-97 for pgsql-hackers@postgresql.org; Thu, 04 Jul 2019 18:02:48 +0000 Received: by mail-wm1-x336.google.com with SMTP id s3so6505353wms.2 for ; Thu, 04 Jul 2019 11:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=klXp1lwtfQ/GKsx4KPqwmuwn9Y3v/AhT7D71cyh5ztE=; b=mx3GM2+/dsy+EBCugH/r2ll/2GCyuS2WebL6+19vTH3EE57188d6SGhAIfmL0h9C/d jrkVEEUx02byPj9ItfhCtOOgJ9wXXq2ArGkj4hW6jt70BSmuxX4E5mCCD3MgkTyF5gmC xhmhhoy9VcYRVmDk1iFA0AF4cJw8IEEdEKZSehUlPM0TNAhCSJlrz9UPrd+YWDwaL/7S CcCSeEiEeHa1bm25HG/dWLKXiG0DIUItJ9MunzYoMvPSIXVwejcs/84p6RBZ+ZoHQmLV cesYToLMff9nEG9Boqd0jJAgXQ7NSWSug9hKRsSro44+YJI8ajk2OS8b6seEA2W9mU5f hD2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=klXp1lwtfQ/GKsx4KPqwmuwn9Y3v/AhT7D71cyh5ztE=; b=qNBBLRv36XEcF8H0Nzj7x0Ai9SD1WVUkjEOR7fMAW++7/ebzyiohB/JvmSF5UWRnGn 8l8+yYEVkOdwxIfoFQKXNTzmc+23JdGtjJb3tvlKZyRNbyK64NcHKgFdnS00Ix6P/mHD dVMF3K0Yj0rxTqbgl6s/EogObKTVk0zdH5rBsj+YSn3Zn8kwlH4d6uJmQ4y3cFuOmNHc KZ0v+Pf79/BnNnHaDFEu9K9t4E7rHdhrEVx7Z0byw/EuzswzoE0InK2ZsZjgAmMj+oGV xKideGyvXVZ23T3eJQ+7QloIFCGaMlECRqiorWxZf0TpKLxhouer4+fBoMsgT+ecjTS5 sp4A== X-Gm-Message-State: APjAAAVyV9oCZNiS8kwlI5JYSXdQn1TD3DgcLDdLkvmK235Ocl734HFB hEHgB7pveYakigGzNgqGi2xD5Z000xajrg== X-Google-Smtp-Source: APXvYqywNRmX5JQNWe62SUeydLDM4cW0acKEIeUpiUWh4nkBu0h6DoHiM2Wa9JRN1JYsFq7o2qil3w== X-Received: by 2002:a1c:238e:: with SMTP id j136mr471005wmj.144.1562263364741; Thu, 04 Jul 2019 11:02:44 -0700 (PDT) Received: from localhost (ip-86-49-253-160.net.upcbroadband.cz. [86.49.253.160]) by smtp.gmail.com with ESMTPSA id w7sm3818808wrl.10.2019.07.04.11.02.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 04 Jul 2019 11:02:43 -0700 (PDT) Date: Thu, 4 Jul 2019 20:02:41 +0200 From: Tomas Vondra To: Andrey Borodin Cc: Binguo Bao , Paul Ramsey , Pgsql Hackers Subject: Re: Optimize partial TOAST decompression Message-ID: <20190704180241.le62zaq5oigwgg6d@development> References: <7B7E4A05-F404-4083-B7F2-267869EE2910@yandex-team.ru> <20190704174654.vnvkh7rusv25o6f5@development> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nwzokxhy3jdspcuu" Content-Disposition: inline In-Reply-To: <20190704174654.vnvkh7rusv25o6f5@development> User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --nwzokxhy3jdspcuu Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Of course, I forgot to attach the files, so here they are. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --nwzokxhy3jdspcuu Content-Type: application/gzip Content-Disposition: attachment; filename="t.data.gz" Content-Transfer-Encoding: base64 H4sICNU1Hl0AA3QuZGF0YQDt0Ee2qgACRdF+jYIhEATpmhCzApJ6oIQnSFIQHX39GkatdXb/ NO49Tp2x3p2G0Hrc35M2Mco0Lg7DWD7f87GZCuX5O+tiN3fUxz2cZcOhGtzgUujKYtbYY63G +/59zH7j3fxJ+qrc2pveqIxFqk/e53azfxXqPrjFRbLbaGbyyNzLr5VVR5cPr40iPsr47oeJ rxefTarsq2iUZye3H+0yutmqJObSRLUi5/xIn40QLPTiPQaZ/fTlKtg/Lstm+310o6ya+p+n T6vpwxz0w+0xV8fWXOuCt/mpgRu4vS+nV+ltC+FNW6aZGi8KU8g37kmzVvaqjts8jac/e9o6 sh0Kh3DpD3NtUu0lJdl+uu3xezl+kv49JMVNLs/2cZGmP/0lhMV93AzT4noKM7v43uptljte ODTK7Cg7B1u+JL/bfe9d5tJvVy/DYKObg6fsLv1zews7bf35bL76kHzLlT7TgsZwXXFz+TXx IUiXWRTNR1MaFO16/1mr0XSkzriEzyytrpN3LfTV4uK9bqfGc87/JkSa/F5uHxermszy5zk3 pE11kOpXKkTXZeWtyqN3fk76SV4PzVwYtFD9W7rjVf44R3H6fedx6td6niefee/9zk6zla13 s3geimD+qJ2m9W9Lv9iL5r14LcW79Z3M7EKauHenLDVtXtmr8/rcfcq3uXS/xsqdKaud++v9 //28mPWlGlm7LrnuD/Unvkp+4bauYWW9eOq11O1ely5qzDR62PXKnn5Wf5krH+eR1h67+npb x5Z3m/Z/2jIs9U3Rx93PL+O60A2vuRqv1tTjnTZaSmgmXlLlmbFRzrtM3O1OYl/keyvbv+Kp oPiGvt8+rZPVrkfxWP0asd4Jn8KaX4WlIwzGcsjva9F5pu12ovj947S1T5o0fA5D8HmX/3JB joLDU5G8wN0USnXdiZdFESdr6SfG3dl8rddp7gjCKvTu0alx2nRmtUsveFfHwej+VR9Fy5Xp zrLPl0GdH2Lx3b2y7PCytTD2dmKx8trxKqVz0/cXzW+RONevGMZ/26m+v5oz9V4Vc+1ufLdd GRn71X5ooiKLupNet7ZvHaRJ0Emi282S5WJ3V5/jo1y3VagWSaHIkmF7EQAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+L/1n/8Cz8gAx6GGAQA= --nwzokxhy3jdspcuu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bt.txt" (gdb) bt #0 toast_decompress_datum (attr=0x12572e0) at tuptoaster.c:2291 #1 toast_decompress_datum (attr=0x12572e0) at tuptoaster.c:2277 #2 0x00000000004c3b08 in heap_tuple_untoast_attr_slice (attr=, sliceoffset=0, slicelength=-1) at tuptoaster.c:315 #3 0x000000000085c1e5 in pg_detoast_datum_slice (datum=, first=, count=) at fmgr.c:1767 #4 0x0000000000833b7a in text_substring (str=133761519127512, start=0, length=, length_not_specified=) at varlena.c:956 #5 0x0000000000600a5b in ExecInterpExpr (state=0x12549c8, econtext=0x1253728, isnull=) at execExprInterp.c:649 #6 0x000000000061511f in ExecEvalExprSwitchContext (isNull=0x7ffc45db755f, econtext=, state=) at ../../../src/include/executor/executor.h:307 #7 advance_aggregates (aggstate=0x1253500, aggstate=0x1253500) at nodeAgg.c:679 #8 agg_retrieve_direct (aggstate=0x1253500) at nodeAgg.c:1847 #9 ExecAgg (pstate=0x1253500) at nodeAgg.c:1572 #10 0x000000000060371b in ExecProcNode (node=0x1253500) at ../../../src/include/executor/executor.h:239 #11 ExecutePlan (execute_once=, dest=0x12595b8, direction=, numberTuples=0, sendTuples=, operation=CMD_SELECT, use_parallel_mode=, planstate=0x1253500, estate=0x12532c0) at execMain.c:1648 #12 standard_ExecutorRun (queryDesc=0x11be580, direction=, count=0, execute_once=) at execMain.c:365 #13 0x0000000000748b2b in PortalRunSelect (portal=portal@entry=0x12043a0, forward=forward@entry=true, count=0, count@entry=9223372036854775807, dest=dest@entry=0x12595b8) at pquery.c:929 #14 0x0000000000749f00 in PortalRun (portal=portal@entry=0x12043a0, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x12595b8, altdest=altdest@entry=0x12595b8, completionTag=0x7ffc45db77e0 "") at pquery.c:770 #15 0x000000000074611f in exec_simple_query (query_string=0x119c820 "select sum(length(substr(a,0))) from t;") at postgres.c:1215 #16 0x000000000074783e in PostgresMain (argc=, argv=argv@entry=0x11c84d0, dbname=, username=) at postgres.c:4249 #17 0x00000000006d75d9 in BackendRun (port=0x11c09e0, port=0x11c09e0) at postmaster.c:4431 #18 BackendStartup (port=0x11c09e0) at postmaster.c:4122 #19 ServerLoop () at postmaster.c:1704 #20 0x00000000006d840c in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x11963e0) at postmaster.c:1377 --nwzokxhy3jdspcuu--