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 1iyf4W-0005gi-KH for pgsql-general@arkaria.postgresql.org; Mon, 03 Feb 2020 16:59:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iyf3V-0005HG-OQ for pgsql-general@arkaria.postgresql.org; Mon, 03 Feb 2020 16:58:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyf3V-0005H9-D2 for pgsql-general@lists.postgresql.org; Mon, 03 Feb 2020 16:58:37 +0000 Received: from smtp.vivaldi.net ([82.221.130.149]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyf3P-00020B-5q for pgsql-general@lists.postgresql.org; Mon, 03 Feb 2020 16:58:36 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.vivaldi.net (Postfix) with ESMTP id 95C0741916; Mon, 3 Feb 2020 16:58:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 smtp.vivaldi.net 95C0741916 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivaldi.net; s=mail; t=1580749109; bh=7HP3ApiBZE2gCsDAUkHrnKtHBHYhkuVjZ/ff0FfPuzA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Gak2ozCJ9Aaf3SpRGI9TPcKnaV/7rfbasAOMb3sXa6Rf5zCYarKOlRJpRH9uHrje2 HyUfCwo/BJUrMLcPrdtGI6qMllVpg7AnSG1PeDQwFXJpLB5D1bjWuLScIPwPBPzNYE Jnc3N0Xjq+9v5hmd4cXyJrMKA++DXA1mZCtpAPomi2gOjVKuqry6/cLW2jZ6SRAmf+ Sl5bzm42tGZxYzxxwui40EUHk1PqMAuV2JyOOM+LJp4Kwjxm6OX6KJz7ZEakxg6XlG j34VRLUXg5aE2Ita2Ord32ljFMCefryHl/Q5QFrKabyyKlI2lcwyUTtnZUeRAtPHe1 lg2AbeCR8KQQA== X-Virus-Scanned: Debian amavisd-new at smtp.vivaldi.net Received: from smtp.vivaldi.net ([127.0.0.1]) by localhost (mxo-new.viv.ext [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wnd-b_U5NVdz; Mon, 3 Feb 2020 16:58:28 +0000 (UTC) Content-Type: text/plain; charset=us-ascii DKIM-Filter: OpenDKIM Filter v2.10.3 smtp.vivaldi.net 36C60417E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivaldi.net; s=mail; t=1580749108; bh=7HP3ApiBZE2gCsDAUkHrnKtHBHYhkuVjZ/ff0FfPuzA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=PD+ayCpRMTBVuhnIo39zxB1QHDBkOlznAVYdv1BLVH8SGBUkrrCiRuT+WF/4jQJKj pugj1jfeDaNj8HTDkHINMIwGiKRCCo9gtBGCIy8vvty855iyR57cpHDW9/tccQ2HRg zlo9S1rgVsuaL0Dl1wWuSXB30FSLpHxRJPNqi1yHBOs3RTirx3lKwzWo87omdcE+x5 72p4wv5tna0wsHyx5aqlhi6B046EpcyykKusS3FGfY5Vj3dcf4te2T0ezyCoqWvIqw NCClCpFmb5zOfqlx8pzO9rqv2PhJ98AksaUoZfTQY9ai95ebJlB3YhczZZkIceQvrV RzKUDkx/ljL4g== Subject: Re: performance of loading CSV data with COPY is 50 times faster than Perl::DBI From: Ravi Krishna In-Reply-To: <20200203100104.2a9d3fcd.lembark@wrkhors.com> Date: Mon, 3 Feb 2020 11:57:14 -0500 Cc: pgsql-general@lists.postgresql.org, Matthias Apitz Content-Transfer-Encoding: 7bit Message-Id: References: <20200131182441.GA8181@c720-r342378> <20200203100104.2a9d3fcd.lembark@wrkhors.com> To: Steven Lembark List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > > Depending on who wrote the code, they may have extracted the rows > as hashrefs rather than arrays; that can be a 10x slowdown right > there. [I have no idea why so many people are so addicted to storing > rows in hashes, but it is always a significant slowdown; and > array slices are no more complicated than hash slices!] I have not done perl code for a while now, but most perl coders, already suffering from a complex of coding in an unreadable language do not prefer to make it worse by using array which is position dependent and hence reading it can be a nightmare when large number of cols are selected. Also isn't array_ref even better than array, since it avoids copying the data to your local array in the code.