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 1hMYKI-0000Jw-9J for pgsql-general@arkaria.postgresql.org; Fri, 03 May 2019 13:34:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hMYKH-0001Qe-0o for pgsql-general@arkaria.postgresql.org; Fri, 03 May 2019 13:34:09 +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 1hMYKF-0001NC-77 for pgsql-general@lists.postgresql.org; Fri, 03 May 2019 13:34:08 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMYKA-0003ks-Hu for pgsql-general@lists.postgresql.org; Fri, 03 May 2019 13:34:06 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C88AB221FD; Fri, 3 May 2019 09:34:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 03 May 2019 09:34:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=j PmKcfj3DoJ4u6Tew+cja42CLco86g/+ik+W4TSfjHw=; b=fh/s1K9CDQEz5fWNY NlaDyrwoz673e9QAKCfrW+XbZcWQBey4PHr0HIrjYFEqtG8pMZkIefLrhqx3N990 Yq6BriqYbU2KUYe12J1Pq5xSU8W5BSV2CyfhTfXYFHg/JkFq1esLv2g9s22qHGp5 LABXTxzdFahSSCFyDO6hWCqvoYY1NldwzzGEkPU+jfcKYNyIFouap2zXOOvuJFEB UAPKe9QevlCHqCPQsGAE1LepqEkWHk88QStHVH7WijLAWJNGL1lvjCQIVqNxHNzq wHaMbuYHMsRaGMZAAJOgeqzuOPrTLLH3g7KsVf8hvxlNdm63muhY628/JfoGvDMd bLmWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=jPmKcfj3DoJ4u6Tew+cja42CLco86g/+ik+W4TSfj Hw=; b=vUVqHB7HgldUzN/+PesRqq8ROyClBBJiHO99xhFg5PmqpzVViDBSyCIC/ AF+/Z3fRO9GCg5utXHKCHgU+hzG4FyKxVRevTmUjQQbqR5C6+/d4LWeqq7htCaIe M04GyOybjdF387QWwVR6Au2W5zViyvwWBibRumWCZJ7cJQ3xJ5KamgCoonJdU9nK 9ifD9J+jAmkuNtFDDuE9sXDIJv+buFE2If0Lh84vFIN3d5C/ljj5KMnyO2/fsom3 AfA4jwQ6pKRwrmXvftQtSnXLy2Fq+hiaCm5Qs42fbTEbRTCLFaKnTHN10JtNrNFg SGtKUcLoN/w1/e7oLKspksQ89YowQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjedugdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecukfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghi lhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 6D1BCE475E; Fri, 3 May 2019 09:33:59 -0400 (EDT) Subject: Re: Migrating database(s) from Sybase ASE 15.7 to PostgreSQL 10.6 on Linux To: Matthias Apitz , pgsql-general@lists.postgresql.org References: <20190503115651.GA22389@sh4-5.1blu.de> <20190503130948.GA29525@sh4-5.1blu.de> From: Adrian Klaver Message-ID: <1e60fdd3-d2ae-a12b-04b0-5831e595217a@aklaver.com> Date: Fri, 3 May 2019 06:33:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190503130948.GA29525@sh4-5.1blu.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/3/19 6:09 AM, Matthias Apitz wrote: > El día Friday, May 03, 2019 a las 07:38:23AM -0500, Ron escribió: > >> On 5/3/19 6:56 AM, Matthias Apitz wrote: >>> Hello, >>> >>> We're investigating the migration of our LMS (Library Managment System) >> >from Sybase ASE 15.7 to PostgreSQL 10.6. The used database in field have >>> around 400 columns, some of them are also containing BLOB (bytea) data. >>> The DB size vary upto 20 GByte. The interfaces contain any kind of >>> language one could imagine :-) ESQL/C, JDBC, Perl DBD, ... >>> >>> Re/ the migration of the data itself, are there any use case studies >>> which could we keep in mind? We plan to export the tables with our own >>> tool which produces CSV with delimiter '|' (and \| if the char | is in >>> char columns too) and with hex representation of the BLOB data. This seems >>> to fit nicely with PostgreSQL's COPY command. >>> >>> Any known pitfalls? >> >> Do you have many stored procedures, functions, etc? > > We have in Sybase triggers on some tables calculating the next value for > an integer "serial" based on helper tables because Sybase does not know > (or did not know in 11.9) about serials. But, these will be replaced by native > "serial" on PG. > > Sybase also has a so called SYB_IDENTITY_COLUMN in each table with a > unique number for each row (may have gaps) and as Sybase does not know > SCROLLED CURSOR we simulated these in our DB layer reading-in all > SYB_IDENTITY_COLUMN numbers of a hit list after SELECT and can read > backwards in this in memory list presenting the requested row with a new > SELECT based on the SYB_IDENTITY_COLUMN number. This is somewhat > clumsy but certain features in upper layers want to read backwards (and > we came from INFORMIX-SE, later INFORMIX-ONL some 30 years ago). > > I was deeply impressed by the COPY command, loading ~35000 rows in the > time one needs to close and open the eyes. As well a SELECT returns in > a table with ~35000 without any INDEX in very short time. How PG does this? In the COPY case the entire thing is done in a single transaction. The downside to this is that a single error in the data will roll back everything. As to SELECT you are seeing the query planner at work. See the sections below for more info: 14.1 https://www.postgresql.org/docs/11/using-explain.html 14.2 https://www.postgresql.org/docs/11/planner-stats.html Indexes are still important. > > matthias > -- Adrian Klaver adrian.klaver@aklaver.com