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 1sp8KB-00Gs5O-LS for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2024 15:35:09 +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 1sp8KB-005Urd-36 for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2024 15:35:07 +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 1sp8KA-005Uqr-3M for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2024 15:35:06 +0000 Received: from mail-eastus2azon11010022.outbound.protection.outlook.com ([52.101.56.22] helo=BN1PR04CU002.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp8K4-000zDJ-FI for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2024 15:35:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sbCHc3zbvvyfVKkS2+bWE+0PZXwq8KT2IQAj8NqCz2nnIBtq9hPoPy/bDOnCemX0XCy4PW64VmYhgf7Y7wuXv1zXljIPBK+eH37GhGHLB74B+3wZG8LwoL4G4iJpGTMxqrBNl18IeSfdlmZT597PAjGEN8sWnc2mMVDbccxc5xB3jofGszFHX/+BIbnSss1vD45Y81w3IYHha3qZGjN6C6ITouTy9epXwCX4F3JE6SzaKgM2KTJko3PtqeGDK6kyMuD/crXqPUsJAKChiPJ2bjfZgzKnhNPAaHD/x2s0VY2DElL/rmty0soTHr27A+QqLUwvIgwx/MDbBJ5IUXYJ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fZ0f3fS/86JSV3sx+I/oK+80AdSNmRng78OyBi+fC2I=; b=QXahQk3IKQcIK/rdauAdpmamnnxntNXnMxfAgjbeR8etgE2iyfW8U8o+ejYnf9j7bmrEzozIZ2dKuOsWepmObJCJ1I3CG/NDFIsfob/jL9cDrAYsorxu6kz1fWWiTrix2hGkUwEN6B9nSPZpKp3oF3yF/WM+I8v4PC4C7wlFXbRGf8eKyMTjYDZhiUR6UNyrwBb8pO7172WAKpw5rQHZGy7n/icS1hJnqDsTRR6M9g2+bFXQApz1wPrwae8Y1hr3V2j00431u6TU2/z+hiqcRdsKwo6VyIlJr1pFMo9oVsBbAcSLyCePDA8uUqtYzrD6FjbdemFPxPBp5ajK5x62wQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=thomsonreuters.com; dmarc=pass action=none header.from=thomsonreuters.com; dkim=pass header.d=thomsonreuters.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thomsonreuters.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fZ0f3fS/86JSV3sx+I/oK+80AdSNmRng78OyBi+fC2I=; b=NIqm/z7RjY4HIksc96fjYpcYjCjy5W/Hw42KXdZp6/943jN9xhXET/Otb/prh0qq7RU8gd5ca4eOCq9+GP8etPYGivyFkk4gzjJR32jjo3DvPLq4iqkj6GNtneb/j+o4Xru7WPq8cMISM28t3afsZskGv/6rtogSLsHGCxatt4g= Received: from CH0PR03MB6100.namprd03.prod.outlook.com (2603:10b6:610:bb::15) by CO1PR03MB5761.namprd03.prod.outlook.com (2603:10b6:303:91::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Fri, 13 Sep 2024 15:34:55 +0000 Received: from CH0PR03MB6100.namprd03.prod.outlook.com ([fe80::db8:9703:284a:ef55]) by CH0PR03MB6100.namprd03.prod.outlook.com ([fe80::db8:9703:284a:ef55%7]) with mapi id 15.20.7962.018; Fri, 13 Sep 2024 15:34:55 +0000 From: "Wong, Kam Fook (TR Technology)" To: pgsql-general Subject: Will hundred of thousands of this type of query cause Parsing issue Thread-Topic: Will hundred of thousands of this type of query cause Parsing issue Thread-Index: AdsF7xbU+NzFH50nRIKowcaOYLn0Kg== Date: Fri, 13 Sep 2024 15:34:55 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=thomsonreuters.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH0PR03MB6100:EE_|CO1PR03MB5761:EE_ x-ms-office365-filtering-correlation-id: 4de5288f-3735-43dd-102f-08dcd4099e28 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?5pGL20MuEV/Me3J/sDuJn0jCGr8W4sAhtb1NR8Kuh8vHwN2xgelt/OmsYQIr?= =?us-ascii?Q?gbzkMjOmaACas03qESQcHi7w6IC1INa+TkL8z7JzRcAA5/StJao9ukzsx9OP?= =?us-ascii?Q?5xPl1gH3ajScg9yR8hT2yOcX/fO4ctySlGpXSj/L4a41FCRD4I8+rOiq3zSY?= =?us-ascii?Q?XaL1IqfJe3NnWGLpyKYhdE3fVVu2YjjBlKaV/Lh8CU8asc3K7wzhCLKSwofR?= =?us-ascii?Q?4xjVoZ9MNi0WEckSz+2Q5rkpsLxJL8pAoPS6UdrPgpKy4JMdxr0wX6lnmEaW?= =?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POizIA5ddR7Vx9S9avjLlzz4tLe?= =?us-ascii?Q?u31ZqnrNjjddcz+MBWm6D10utZPVhSVUGXiyGuEzD3gPr6JYrW4U+z5gltW/?= =?us-ascii?Q?7bHp3lVhinmuUg5Cewkx3tL/sVR4feJxTv56Vmtk2OLS3FW27koF9183bY6w?= =?us-ascii?Q?HdtdvPF5ZyLvYqwL4s3gLL4f/aTlldgfUoSnD/e9hdW2A3USDuU6DpfVOspK?= =?us-ascii?Q?6DgM77JE8EVXSiegRwU+af4o3vS3qPIR7iUjTWoiswiLIz7U6A=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR03MB6100.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+CtkB0sVg37bCfP63ShXCJGd+JnC2MRziS64HP5AaOpawzn/9enfYDmm6kyN?= =?us-ascii?Q?5lE6zdI5t1HYprpBXNFfyRrjkGftnf8OcKsb6AfV7Z5432WDWebbFJuJnguL?= =?us-ascii?Q?pDYkPV4Stcz3b06dj3joM4m8T+eOdzIoYw0O53Y7bUrZBVoHXLd8lkNdAQ9w?= =?us-ascii?Q?ZPJdEL2NgRL9aE3ECDAp/vpFdo7M2pyPHQZMt3DGleQV3108FQefCTrLSmIL?= =?us-ascii?Q?lsNbGMZzM3+6OBhs3NxqKdPv0m9Wv7ZXZ9FnPP9H0ztWKqOpdg9wYGYHivin?= =?us-ascii?Q?YwPUswcyztrNDZYT2uPGO8g5r41h5IHT2GGHbwsAyzTGjaktg6hLepG5TZI1?= =?us-ascii?Q?AjbglD7vdBiEieySyPehtos2HZXSMRyKPLFDSe1OQ0hsb1MjJs6fK+MVWFi6?= =?us-ascii?Q?/EPCqYq6JcXs8FThpmh+j8XzWPpkXiU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CzaC/MMzxkx59CGNqTjTADrPQH02/pEL7ifmP7dbGAkn0lk4zrIeO8Xuv?= =?us-ascii?Q?bDH1vj5HVnII4KJLaHt17OxqEV5wNGlqiCoeV1ctg8kcKy5BadkvSIvhU05t?= =?us-ascii?Q?WmDK/eGv7RB8FV+/D5kvQCJk1s4LtdA9ptqd6jV2Uo2n73QZmfD6ohnKO+lQ?= =?us-ascii?Q?xFY3Yob9c/sjzvPnYuQSWmSxaOb9xaKvEiSOOOCirqEz04lMy4TBSsidDqOq?= =?us-ascii?Q?/ZSScfYFyUEUfVeH8zCadEo37+cQRylNGkvHjwecJeW3fYypHdMXrR5YLwjm?= =?us-ascii?Q?4Q=3D=3D?= Content-Type: multipart/alternative; boundary="_000_CH0PR03MB610085FA248C69CDB73494FFFE652CH0PR03MB6100namp_" MIME-Version: 1.0 X-OriginatorOrg: thomsonreuters.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH0PR03MB6100.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4de5288f-3735-43dd-102f-08dcd4099e28 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Sep 2024 15:34:55.2928 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 62ccb864-6a1a-4b5d-8e1c-397dec1a8258 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /7MywoiqFdda+NqWnXBqTZ28rZQeOkexX8bPP40n/5L+1CYnbzn4uNd5TnefhGadFE0Hl1hO2qCUxsRXAj+9oi55lkLbgoAwXgGTaRLdhpY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR03MB5761 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_CH0PR03MB610085FA248C69CDB73494FFFE652CH0PR03MB6100namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Follow Postgres expert, We have a flavor of this type of query with long in-list/bind variables (se= e below). We notice that some of the bind variables come in as 0 which cau= ses the optimizer to choose to full scan two of the following 3 tables. On= e thought to fix a full table scan is to chop off the not-needed bind varia= bles (proven to work after some tests). But my other worry is will cause p= arsing issues because the app will be executing > 100k/sec with this type o= f query. I am an Oracle DBA, and this change for sure will generate a different quer= y id. Which in turn generates tons of extra parsing to the DB because all = soft and hard parsing occurs at the DB level. But my understanding for Pos= tgres is parsing occurs at the client jdbc level. Am I understanding this = correctly? In summary/my concern: 1) Where does query parsing occur? 2) Will this cause extra parsing to the posgress DB? Any pg system table t= o measure parsing? SELECT abc, efg from DOCLOC a, COLLECTION b WHERE a.colum1 IN ($1, $2, $= 3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19= , $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34= , $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49= , $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60, $61, $62, $63, $64= , $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79= , $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94= , $95, $96, $97, $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, = $108, $109, $110, $111, $112, $113, $114, $115, $116, $117, $118, $119, $12= 0, $121, $122, $123, $124, $125, $126, $127, $128, $129, $130, $131, $132, = $133, $134, $135, $136, $137, $138, $139, $140, $141, $142, $143, $144, $14= 5, $146, $147, $148, $149, $150, $151, $152, $153, $154, $155, $156, $157, = $158, $159, $160, $161, $162, $163, $164, $165, $166, $167, $168, $169, $17= 0, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, = $183, $184, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $19= 5, $196, $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, = $208, $209, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $22= 0, $221, $222, $223, $224, $225, $226, $227, $228, $229, $230, $231, $232, = $233, $234, $235, $236, $237, $238, $239, $240, $241, $242, $243, $244, $24= 5, $246, $247, $248, $249, $250, $251, $252, $253, $254, $255, $256, $257, = $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $27= 0, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282, = $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $29= 5, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, = $308, $309, $310, $311, $312, $313, $314, $315, $316, $317, $318, $319, $32= 0, $321, $322, $323, $324, $325, $326, $327, $328, $329, $330, $331, $332, = $333, $334, $335, $336, $337, $338, $339, $340, $341, $342, $343, $344, $34= 5, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $356, $357, = $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368, $369, $37= 0, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $381, $382, = $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $39= 5, $396, $397, $398, $399, $400, $401, $402, $403, $404, $405, $406, $407, = $408, $409, $410, $411, $412, $413, $414, $415, $416, $417, $418, $419, $42= 0, $421, $422, $423, $424, $425, $426, $427, $428, $429, $430, $431, $432, = $433, $434, $435, $436, $437, $438, $439, $440, $441, $442, $443, $444, $44= 5, $446, $447, $448, $449, $450, $451, $452, $453, $454, $455, $456, $457, = $458, $459, $460, $461, $462, $463, $464, $465, $466, $467, $468, $469, $47= 0, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, = $483, $484, $485, $486, $487, $488, $489, $490, $491, $492, $493, $494, $49= 5, $496, $497, $498, $499, $500, $501, $502, $503, $504, $505, $506, $507, = $508, $509, $510, $511, $512, $513, $514, $515, $516, $517, $518, $519, $52= 0, $521, $522, $523, $524, $525, $526, $527, $528, $529, $530, $531, $532, = $533, $534, $535, $536, $537, $538, $539, $540, $541, $542, $543, $544, $54= 5, $546, $547, $548, $549, $550, $551, $552, $553, $554, $555, $556, $557, = $558, $559, $560, $561, $562, $563, $564, $565, $566, $567, $568, $569, $57= 0, $571, $572, $573, $574, $575, $576, $577, $578, $579, $580, $581, $582, = $583, $584, $585, $586, $587, $588, $589, $590, $591, $592, $593, $594, $59= 5, $596, $597, $598, $599, $600, $601, $602, $603, $604, $605, $606, $607, = $608, $609, $610, $611, $612, $613, $614, $615, $616, $617, $618, $619, $62= 0, $621, $622, $623, $624, $625, $626, $627, $628, $629, $630, $631, $632, = $633, $634, $635, $636, $637, $638, $639, $640, $641, $642, $643, $644, $64= 5, $646, $647, $648, $649, $650, $651, $652, $653, $654, $655, $656, $657, = $658, $659, $660, $661, $662, $663, $664, $665, $666, $667, $668, $669, $67= 0, $671, $672, $673, $674, $675, $676, $677, $678, $679, $680, $681, $682, = $683, $684, $685, $686, $687, $688, $689, $690, $691, $692, $693, $694, $69= 5, $696, $697, $698, $699, $700, $701, $702, $703, $704, $705, $706, $707, = $708, $709, $710, $711, $712, $713, $714, $715, $716, $717, $718, $719, $72= 0, $721, $722, $723, $724, $725, $726, $727, $728, $729, $730, $731, $732, = $733, $734, $735, $736, $737, $738, $739, $740, $741, $742, $743, $744, $74= 5, $746, $747, $748, $749, $750, $751, $752, $753, $754, $755, $756, $757, = $758, $759, $760, $761, $762, $763, $764, $765, $766, $767, $768, $769, $77= 0, $771, $772, $773, $774, $775, $776, $777, $778, $779, $780, $781, $782, = $783, $784, $785, $786, $787, $788, $789, $790, $791, $792, $793, $794, $79= 5, $796, $797, $798, $799, $800, $801, $802, $803, $804, $805, $806, $807, = $808, $809, $810, $811, $812, $813, $814, $815, $816, $817, $818, $819, $82= 0, $821, $822, $823, $824, $825, $826, $827, $828, $829, $830, $831, $832, = $833, $834, $835, $836, $837, $838, $839, $840, $841, $842, $843, $844, $84= 5, $846, $847, $848, $849, $850, $851, $852, $853, $854, $855, $856, $857, = $858, $859, $860, $861, $862, $863, $864, $865, $866, $867, $868, $869, $87= 0, $871, $872, $873, $874, $875, $876, $877, $878, $879, $880, $881, $882, = $883, $884, $885, $886, $887, $888, $889, $890, $891, $892, $893, $894, $89= 5, $896, $897, $898, $899, $900, $901, $902, $903, $904, $905, $906, $907, = $908, $909, $910, $911, $912, $913, $914, $915, $916, $917, $918, $919, $92= 0, $921, $922, $923, $924, $925, $926, $927, $928, $929, $930, $931, $932, = $933, $934, $935, $936, $937, $938, $939, $940, $941, $942, $943, $944, $94= 5, $946, $947, $948, $949, $950, $951, $952, $953, $954, $955, $956, $957, = $958, $959, $960, $961, $962, $963, $964, $965, $966, $967, $968, $969, $97= 0, $971, $972, $973, $974, $975, $976, $977, $978, $979, $980, $981, $982, = $983, $984, $985, $986, $987, $988, $989, $990, $991, $992, $993, $994, $99= 5, $996, $997, $998, $999, $1000) AND a.COLLECTION_NAME=3Db.DOCLOC.COLLECTI= ON_NAME AND a.DOCLOC.STAGE_ID=3D(SELECT MAX (STAGE_ID) FROM COLLECTION_PIT WHERE COLLECTION_PIT.COLLECTION_NAME=3Da.COLLECTION_NAME AND COLLECTION_PIT.PIT_ID<=3D$1001 AND COLLECTION_PIT.STAGE_CODE=3D$1002) This e-mail is for the sole use of the intended recipient and contains info= rmation that may be privileged and/or confidential. If you are not an inten= ded recipient, please notify the sender by return e-mail and delete this e-= mail and any attachments. Certain required legal entity disclosures can be = accessed on our website: https://www.thomsonreuters.com/en/resources/disclo= sures.html --_000_CH0PR03MB610085FA248C69CDB73494FFFE652CH0PR03MB6100namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Follow Postgres exp= ert,

We have a flavor of this type of query with long in-list/bind variables (se= e below).  We notice that some of the bind variables come in as 0 whic= h causes the optimizer to choose to full scan two of the following 3 tables= .  One thought to fix a full table scan is to chop off the not-needed bind variables (proven to work after some te= sts).  But my other worry is will cause parsing issues because the app= will be executing > 100k/sec with this type of query.

I am an Oracle DBA, and this change for sure will generate a different quer= y id.  Which in turn generates tons of extra parsing to the DB because= all soft and hard parsing occurs at the DB level.  But my understandi= ng for Postgres is parsing occurs at the client jdbc level.  Am I understanding this correctly? 


In summary/my concern:

1) Where does query parsing occur?
2) Will this cause extra parsing to the posgress DB?  Any pg system ta= ble to measure parsing? 

 

SELECT  abc, ef= g from DOCLOC a, COLLECTION b  WHERE  a.colum1 IN ($1, $2, $3, $4= , $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20= , $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45,= $46, $47, $48, $49, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60,= $61, $62, $63, $64, $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75,= $76, $77, $78, $79, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94, $95, $96, $97,= $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, $108, $109, $110= , $111, $112, $113, $114, $115, $116, $117, $118, $119, $120, $121, $122, $= 123, $124, $125, $126, $127, $128, $129, $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140, $1= 41, $142, $143, $144, $145, $146, $147, $148, $149, $150, $151, $152, $153,= $154, $155, $156, $157, $158, $159, $160, $161, $162, $163, $164, $165, $1= 66, $167, $168, $169, $170, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, $183, $1= 84, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $195, $196,= $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, $208, $2= 09, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $220, $221, $222, $223, $224, $225, $226, $2= 27, $228, $229, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239,= $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $250, $251, $2= 52, $253, $254, $255, $256, $257, $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $2= 70, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282,= $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $2= 95, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, $308, $309, $310, $311, $312, $3= 13, $314, $315, $316, $317, $318, $319, $320, $321, $322, $323, $324, $325,= $326, $327, $328, $329, $330, $331, $332, $333, $334, $335, $336, $337, $3= 38, $339, $340, $341, $342, $343, $344, $345, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $3= 56, $357, $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368,= $369, $370, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $3= 81, $382, $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $395, $396, $397, $398, $3= 99, $400, $401, $402, $403, $404, $405, $406, $407, $408, $409, $410, $411,= $412, $413, $414, $415, $416, $417, $418, $419, $420, $421, $422, $423, $4= 24, $425, $426, $427, $428, $429, $430, $431, $432, $433, $434, $435, $436, $437, $438, $439, $440, $441, $4= 42, $443, $444, $445, $446, $447, $448, $449, $450, $451, $452, $453, $454,= $455, $456, $457, $458, $459, $460, $461, $462, $463, $464, $465, $466, $4= 67, $468, $469, $470, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, $483, $484, $4= 85, $486, $487, $488, $489, $490, $491, $492, $493, $494, $495, $496, $497,= $498, $499, $500, $501, $502, $503, $504, $505, $506, $507, $508, $509, $5= 10, $511, $512, $513, $514, $515, $516, $517, $518, $519, $520, $521, $522, $523, $524, $525, $526, $527, $5= 28, $529, $530, $531, $532, $533, $534, $535, $536, $537, $538, $539, $540,= $541, $542, $543, $544, $545, $546, $547, $548, $549, $550, $551, $552, $5= 53, $554, $555, $556, $557, $558, $559, $560, $561, $562, $563, $564, $565, $566, $567, $568, $569, $570, $5= 71, $572, $573, $574, $575, $576, $577, $578, $579, $580, $581, $582, $583,= $584, $585, $586, $587, $588, $589, $590, $591, $592, $593, $594, $595, $5= 96, $597, $598, $599, $600, $601, $602, $603, $604, $605, $606, $607, $608, $609, $610, $611, $612, $613, $6= 14, $615, $616, $617, $618, $619, $620, $621, $622, $623, $624, $625, $626,= $627, $628, $629, $630, $631, $632, $633, $634, $635, $636, $637, $638, $6= 39, $640, $641, $642, $643, $644, $645, $646, $647, $648, $649, $650, $651, $652, $653, $654, $655, $656, $6= 57, $658, $659, $660, $661, $662, $663, $664, $665, $666, $667, $668, $669,= $670, $671, $672, $673, $674, $675, $676, $677, $678, $679, $680, $681, $6= 82, $683, $684, $685, $686, $687, $688, $689, $690, $691, $692, $693, $694, $695, $696, $697, $698, $699, $7= 00, $701, $702, $703, $704, $705, $706, $707, $708, $709, $710, $711, $712,= $713, $714, $715, $716, $717, $718, $719, $720, $721, $722, $723, $724, $7= 25, $726, $727, $728, $729, $730, $731, $732, $733, $734, $735, $736, $737, $738, $739, $740, $741, $742, $7= 43, $744, $745, $746, $747, $748, $749, $750, $751, $752, $753, $754, $755,= $756, $757, $758, $759, $760, $761, $762, $763, $764, $765, $766, $767, $7= 68, $769, $770, $771, $772, $773, $774, $775, $776, $777, $778, $779, $780, $781, $782, $783, $784, $785, $7= 86, $787, $788, $789, $790, $791, $792, $793, $794, $795, $796, $797, $798,= $799, $800, $801, $802, $803, $804, $805, $806, $807, $808, $809, $810, $8= 11, $812, $813, $814, $815, $816, $817, $818, $819, $820, $821, $822, $823, $824, $825, $826, $827, $828, $8= 29, $830, $831, $832, $833, $834, $835, $836, $837, $838, $839, $840, $841,= $842, $843, $844, $845, $846, $847, $848, $849, $850, $851, $852, $853, $8= 54, $855, $856, $857, $858, $859, $860, $861, $862, $863, $864, $865, $866, $867, $868, $869, $870, $871, $8= 72, $873, $874, $875, $876, $877, $878, $879, $880, $881, $882, $883, $884,= $885, $886, $887, $888, $889, $890, $891, $892, $893, $894, $895, $896, $8= 97, $898, $899, $900, $901, $902, $903, $904, $905, $906, $907, $908, $909, $910, $911, $912, $913, $914, $9= 15, $916, $917, $918, $919, $920, $921, $922, $923, $924, $925, $926, $927,= $928, $929, $930, $931, $932, $933, $934, $935, $936, $937, $938, $939, $9= 40, $941, $942, $943, $944, $945, $946, $947, $948, $949, $950, $951, $952, $953, $954, $955, $956, $957, $9= 58, $959, $960, $961, $962, $963, $964, $965, $966, $967, $968, $969, $970,= $971, $972, $973, $974, $975, $976, $977, $978, $979, $980, $981, $982, $9= 83, $984, $985, $986, $987, $988, $989, $990, $991, $992, $993, $994, $995, $996, $997, $998, $999, $1000) A= ND a.COLLECTION_NAME=3Db.DOCLOC.COLLECTION_NAME AND a.DOCLOC.STAGE_ID=3D(SE= LECT MAX (STAGE_ID)

FROM COLLECTION_PIT =

WHERE COLLECTION_PIT= .COLLECTION_NAME=3Da.COLLECTION_NAME

AND COLLECTION_PIT.P= IT_ID<=3D$1001 AND COLLECTION_PIT.STAGE_CODE=3D$1002)

This e-mail is for the sole use of the intended recipient and contains info= rmation that may be privileged and/or confidential. If you are not an inten= ded recipient, please notify the sender by return e-mail and delete this e-= mail and any attachments. Certain required legal entity disclosures can be accessed on our website: https://= www.thomsonreuters.com/en/resources/disclosures.html --_000_CH0PR03MB610085FA248C69CDB73494FFFE652CH0PR03MB6100namp_--