Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lD6YF-0007h8-Rb for pgsql-general@arkaria.postgresql.org; Fri, 19 Feb 2021 14:14:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lD6YE-0001rQ-Oj for pgsql-general@arkaria.postgresql.org; Fri, 19 Feb 2021 14:14:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lD6YE-0001qV-H3 for pgsql-general@lists.postgresql.org; Fri, 19 Feb 2021 14:14:34 +0000 Received: from mxh02aws156.mxout.inova.com.br ([34.199.21.156] helo=mxhero02.a.inova.com.br) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lD6Y9-0001Np-C6 for pgsql-general@lists.postgresql.org; Fri, 19 Feb 2021 14:14:34 +0000 Received: from localhost (localhost [127.0.0.1]) by mxhero02.a.inova.com.br (Postfix) with ESMTP id AC2DE192814 for ; Fri, 19 Feb 2021 14:14:26 +0000 (UTC) Received: from corpmoutpolicyd01.a.inova.com.br (ip-10-0-1-88.ec2.internal [10.0.1.88]) by mxhero02.a.inova.com.br (Postfix) with ESMTP; Fri, 19 Feb 2021 14:14:26 +0000 (UTC) Received: from corpmoutpolicyd01.a.inova.com.br (localhost [127.0.0.1]) by corpmoutpolicyd01.a.inova.com.br (Postfix) with ESMTP id 88766220FB7; Fri, 19 Feb 2021 12:14:21 -0200 (BRST) Received: from corpmout01.a.inova.com.br (ip-10-0-1-125.ec2.internal [10.0.1.125]) by corpmoutpolicyd01.a.inova.com.br (Postfix) with ESMTP id 73321C34F4; Fri, 19 Feb 2021 12:14:21 -0200 (BRST) Received: from corpmbox02.a.inova.com.br (ip-10-0-4-158.ec2.internal [10.0.4.158]) by corpmout01.a.inova.com.br (Postfix) with ESMTP; Fri, 19 Feb 2021 11:14:21 -0300 (-03) Date: Fri, 19 Feb 2021 11:14:21 -0300 (BRT) From: luis.roberto@siscobra.com.br To: sivapostgres Cc: Benedict Holland , pgsql-general , Thomas Kellerer Message-ID: <101934889.11201966.1613744061342.JavaMail.zimbra@siscobra.com.br> In-Reply-To: <1960558743.2113146.1613570978228@mail.yahoo.com> References: <1671732859.1031650.1613563275311.ref@mail.yahoo.com> <1671732859.1031650.1613563275311@mail.yahoo.com> <951d8c4c-369d-63b3-f323-83660d96276f@gmx.net> <1566185888.2096515.1613568453936@mail.yahoo.com> <1960558743.2113146.1613570978228@mail.yahoo.com> Subject: Re: Slow while inserting and retrieval (compared to SQL Server) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.0.4.158] X-Mailer: Zimbra 8.8.15_GA_3980 (ZimbraWebClient - GC88 (Win)/8.8.15_GA_3980) Thread-Topic: Slow while inserting and retrieval (compared to SQL Server) Thread-Index: 8d4jFCbSS5KxOhGRWkSTnQSRS51pqg== x-mxHero-Origin-Ip: /127.0.0.1:60982 X-mxHero-AttachmentBlock: rule=48;result=false List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > De: "sivapostgres" > Para: "Benedict Holland" > Cc: "pgsql-general" , "Thomas Kellere= r" > Enviadas: Quarta-feira, 17 de fevereiro de 2021 11:09:38 > Assunto: Re: Slow while inserting and retrieval (compared to SQL Server) > So far no performance tuning done for sql server.=C2=A0 It works fine for= the load. > Even the express edition which is free, works better.=C2=A0 I don't think= postgres > will be so slow to insert such a low number of records in an empty databa= se. > I'll be preparing the required sql statements to insert those records in = pgadmin > and see the timings, tomorrow. >=20 > On Wednesday, 17 February, 2021, 07:29:29 pm IST, Benedict Holland > wrote: >=20 > Sql server is a 10k dollar to 1 million dollar application (or more) that= is > specifically optimized for windows and had limited to no support anywhere= else. > Postgres is free and from my experience, comes within 5% of any other dbm= s. > Inserting 1 row at a time with auto commit on will be a bit slow but it > shouldn't be noticeable. What times are you seeing if you do this with pg= admin4 > compared to sql server? Also, have you done any performance tuning for po= stgres > server? There are many documents detailing performance tuning your server= s, > like you probably did, at some point, with your sql server. > Thanks,Ben > On Wed, Feb 17, 2021, 8:28 AM sivapostgres@yahoo.com > wrote: >=20 > We use datawindows.=C2=A0 Datawindows will send the required DML statemen= ts to the > database.=C2=A0 And it sent in format 1 . > IN start of the application, Autocommit set to True.Before update of any > table(s)Autocommit is set to FalseInsert/Update/Delete recordsIf success = commit > else rollbackAutocommit is set to True > This has been followed for decades and it's working fine with Sql server. > Here we are trying to insert just 10 records spread across 6 tables, whic= h is > taking more time.. that's what we feel.=C2=A0 =C2=A0The similar work in S= QL Server takes > much less time < as if no wait is there >. > On Wednesday, 17 February, 2021, 06:48:35 pm IST, Thomas Kellerer > wrote: >=20 > sivapostgres@yahoo.com schrieb am 17.02.2021 um 13:01: >> To populate some basic data we try to insert few records (max 4 >> records) in few tables (around 6 tables) from one window.=C2=A0 We feel >> that the insert time taken is longer than the time taken while using >> Sql Server.=C2=A0 We tested almost a similar window that updated the >> similar table(s) in SQL server, which was faster.=C2=A0 With Postgres >> database, we need to wait for a couple of seconds before the >> insert/update is over, which we didn't feel in Sql Server. >=20 >=20 > Are you doing single-row inserts like: >=20 >=C2=A0 =C2=A0 insert into ... values (..); >=C2=A0 =C2=A0 insert into ... values (..); >=C2=A0 =C2=A0 insert into ... values (..); >=C2=A0 =C2=A0 insert into ... values (..); >=20 > or are you doing multi-row inserts like this: >=20 >=C2=A0 =C2=A0 insert into ... values (..), (..), (..), (..); >=20 > Typically the latter will perform much better (especially if autocommit i= s > enabled) Please provide the EXPLAIN ANALYZE plans so we can take a look at what is c= ausing these 'slow' inserts.