You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/latest/migrate/migrate-from-postgresql/_index.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
1
---
2
-
title: Migrating From PostgreSQL
3
-
linkTitle: Migrating From PostgreSQL
4
-
description: Migrating from PostgreSQL to YugabyteDB
2
+
title: Migrate PostgreSQL data and applications
3
+
headerTitle: Migrate from PostgreSQL
4
+
linkTitle: Migrate from PostgreSQL
5
+
description: Steps for migrating PostgreSQL data and applications to YugabyteDB.
5
6
image: /images/section_icons/develop/learn.png
6
7
menu:
7
8
latest:
@@ -10,7 +11,7 @@
10
11
weight: 730
11
12
---
12
13
13
-
The steps below outline how to migrate from PostgreSQL to YugabyteDB manually. The sections below assume familiarity with the high level migration process to YugabyteDB.
14
+
The steps below cover how to manually migrate PostgreSQL data and applications to YugabyteDB. The sections below assume that you have read [Migration process overview](../migration-process-overview).
14
15
15
16
{{< note title="Note" >}}
16
17
@@ -27,7 +28,7 @@
27
28
<div class="icon">
28
29
<i class="icon-database-alt2"></i>
29
30
</div>
30
-
<divclass="title">Schema Migration</div>
31
+
<div class="title">Migrate a DDL schema</div>
31
32
</div>
32
33
<div class="body">
33
34
Migrate your DDL schema from PostgreSQL to YugabyteDB.
@@ -41,10 +42,10 @@
41
42
<div class="icon">
42
43
<i class="icon-database-alt2"></i>
43
44
</div>
44
-
<divclass="title">Application Migration</div>
45
+
<div class="title">Migrate a PostgreSQL application</div>
45
46
</div>
46
47
<div class="body">
47
-
Migrate an application written for PostgreSQL to YugabyteDB.
48
+
Migrate a PostgreSQL application to YugabyteDB.
48
49
</div>
49
50
</a>
50
51
</div>
@@ -55,10 +56,10 @@
55
56
<div class="icon">
56
57
<i class="icon-database-alt2"></i>
57
58
</div>
58
-
<divclass="title">Export Data</div>
59
+
<div class="title">Export PostgreSQL data</div>
59
60
</div>
60
61
<div class="body">
61
-
Export data from PostgreSQL.
62
+
Export data from PostgreSQL for importing into YugabyteDB.
62
63
</div>
63
64
</a>
64
65
</div>
@@ -69,7 +70,7 @@
69
70
<div class="icon">
70
71
<i class="icon-database-alt2"></i>
71
72
</div>
72
-
<divclass="title">Prepare Cluster</div>
73
+
<div class="title">Prepare a cluster</div>
73
74
</div>
74
75
<div class="body">
75
76
Prepare your YugabyteDB cluster for data import.
@@ -83,10 +84,10 @@
83
84
<div class="icon">
84
85
<i class="icon-database-alt2"></i>
85
86
</div>
86
-
<divclass="title">Import Data</div>
87
+
<div class="title">Import PostgreSQL data</div>
87
88
</div>
88
89
<div class="body">
89
-
Import data into the YugabyteDB cluster.
90
+
Import PostgreSQL data into a YugabyteDB cluster.
90
91
</div>
91
92
</a>
92
93
</div>
@@ -97,10 +98,10 @@
97
98
<div class="icon">
98
99
<i class="icon-database-alt2"></i>
99
100
</div>
100
-
<divclass="title">Verify Migration</div>
101
+
<div class="title">Verify the migration</div>
101
102
</div>
102
103
<div class="body">
103
-
Verify the result of the migration to YugabyteDB.
104
+
Verify the migration to YugabyteDB was successful.
Copy file name to clipboardExpand all lines: docs/content/latest/migrate/migrate-from-postgresql/import-data.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
2
2
---
3
-
title: Import Data
4
-
headerTitle: Import Data
5
-
linkTitle: Import Data
6
-
description: How to import data into YugabyteDB.
3
+
title: Import PostgreSQL data
4
+
headerTitle: Import PostgreSQL data
5
+
linkTitle: Import PostgreSQL data
6
+
description: Steps for importing PostgreSQL data into YugabyteDB.
7
7
menu:
8
8
latest:
9
9
identifier: migrate-postgresql-import-data
@@ -13,7 +13,7 @@ isTocNested: false
13
13
showAsideToc: true
14
14
---
15
15
16
-
The next step is to import the data that was previously exported into YugabyteDB.
16
+
The next step is to import the PostgreSQL data into YugabyteDB.
17
17
18
18
{{< note title="Note" >}}
19
19
After the data import step, remember to recreate any constraints and triggers that might have been disabled to speed up loading the data. This would ensure that the database will perform relational integrity checking for data going forward.
Copy file name to clipboardExpand all lines: docs/content/latest/migrate/migrate-from-postgresql/migrate-schema.md
+25-22Lines changed: 25 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
-
title: Schema Migration
3
-
headerTitle: Schema Migration
4
-
linkTitle: Schema Migration
5
-
description: How to migrate PostgreSQL schema to YugabyteDB.
2
+
title: Convert a PostgreSQL schema
3
+
headerTitle: Convert a PostgreSQL schema
4
+
linkTitle: Convert a PostgreSQL schema
5
+
description: Steps for migrating a PostgreSQL schema for YugabyteDB.
6
6
menu:
7
7
latest:
8
8
identifier: migrate-postgresql-schema
@@ -20,13 +20,14 @@ Using `ysql_dump` tool can simplify some steps of your schema migration, [read m
20
20
21
21
{{< /tip >}}
22
22
23
-
24
23
## Specify `PRIMARY KEY` inline
25
24
26
25
YugabyteDB (as of v2.2) does not support the PostgreSQL syntax of first declaring a table, and subsequently running an ALTER TABLE command to add the primary key. This is because the data in YugabyteDB tables are index-organized according to the primary key specification. There is a significant performance difference in a distributed SQL database between a table that is organized by row id with an added primary key constraint, versus a table whose data layout is index-organized from the get go.
27
26
28
27
{{< note title="Note" >}}
29
-
Altering the primary key of a table after creation is a planned feature, the current status of this enhancement is tracked [here](https://github.com/yugabyte/yugabyte-db/issues/1104).
28
+
29
+
Altering the primary key of a table after creation is a planned feature, the current status of this enhancement is tracked in [GitHub issue #1104](https://github.com/yugabyte/yugabyte-db/issues/1104).
30
+
30
31
{{< /note >}}
31
32
32
33
@@ -44,42 +45,45 @@ To overcome the above issues, YugabyteDB supports `HASH` ordering in addition to
44
45
45
46
* Range queries **cannot** be efficiently supported on the index
46
47
47
-
48
-
## Optimize DBs with many objects
48
+
## Optimize databases with many objects
49
49
50
50
{{< tip title="Tip" >}}
51
+
51
52
Databases with over 500 objects (tables, indexes and unique constraints mainly) would benefit from the colocation optimization here. Colocation also improves join performance for smaller tables.
53
+
52
54
{{< /tip >}}
53
55
54
56
In many scenarios, there may be a large number of database objects (tables and indexes specifically) which hold a relatively small dataset. In such cases, creating a separate tablet for each table and index could drastically reduce performance. Colocating these tables and indexes into a single tablet can drastically improve performance.
55
57
56
58
Enabling the colocation property at a database level causes all tables created in this database to be colocated by default. Tables in this database that hold a large dataset or those that are expected to grow in size over time can be opted out of the colocation group, which would cause them to be split into multiple tablets.
57
59
58
60
{{< note title="Note" >}}
61
+
59
62
Making colocation the default for all databases is [work in progress](https://github.com/yugabyte/yugabyte-db/issues/5239).
60
-
{{< /note >}}
61
63
64
+
{{< /note >}}
62
65
63
66
## Pre-split large tables
64
67
65
-
For larger tables/indexes that are hashsharded, specify the number of initial tablet splits desired as a part of the DDL statement of the table. This can be very beneficial to distribute the data of the table across multiple nodes right from the get go. An example of specifying the number of tablets at table creation time is shown [here](https://docs.yugabyte.com/latest/architecture/docdb-sharding/tablet-splitting/#hash-sharded-tables).
68
+
For larger tables and indexes that are hash-sharded, specify the number of initial tablet splits desired as a part of the DDL statement of the table. This can be very beneficial to distribute the data of the table across multiple nodes right from the get go. An example of specifying the number of tablets at table creation time is shown [here](https://docs.yugabyte.com/latest/architecture/docdb-sharding/tablet-splitting/#hash-sharded-tables).
66
69
67
-
For larger tables/indexes that are rangesharded and the value ranges of the primary key columns are known ahead of time, pre-split them at the time of creation. This is especially beneficial for range sharded tables/indexes. Pre-split an index using the syntax shown [here](https://docs.yugabyte.com/latest/architecture/docdb-sharding/tablet-splitting/#range-sharded-tables).
70
+
For larger tables and indexes that are range-sharded and the value ranges of the primary key columns are known ahead of time, pre-split them at the time of creation. This is especially beneficial for range sharded tables/indexes. Pre-split an index using the syntax shown [here](https://docs.yugabyte.com/latest/architecture/docdb-sharding/tablet-splitting/#range-sharded-tables).
68
71
69
-
## Remove collation on columns
72
+
## Remove collation on columns
70
73
71
74
YugabyteDB does not currently support any collation options using the COLLATE keyword (adding [collation support is in the roadmap](https://github.com/YugaByte/yugabyte-db/issues/1127)). Remove the COLLATE options in order move the schema over to YugabyteDB.
72
75
73
76
For example, consider the table definition below.
74
77
75
-
```
78
+
```postgresql
76
79
CREATE TABLE test1 (
77
80
a text COLLATE "de_DE" PRIMARY KEY,
78
81
b text COLLATE "es_ES"
79
82
);
80
83
```
81
84
82
85
Attempting to create this table would result in the following error.
86
+
83
87
```
84
88
ERROR: 0A000: COLLATE not supported yet
85
89
LINE 2: a text COLLATE "de_DE" PRIMARY KEY,
@@ -91,20 +95,20 @@ Time: 31.543 ms
91
95
92
96
The COLLATE options should be dropped as shown below.
93
97
94
-
```
98
+
```postgresql
95
99
CREATE TABLE test1 (
96
100
a text PRIMARY KEY,
97
101
b text
98
102
);
99
103
```
100
104
101
-
## Optimize sequences (`SERIAL`)
105
+
## Optimize sequences (SERIAL)
102
106
103
107
All sequences in your schema currently use a default `CACHE` value of 1. In a distributed DB, this will result in each `INSERT` performing extra RPC calls to generate new row ids, dramatically reducing write performance.
104
108
105
109
Consider the following table as an example.
106
110
107
-
```
111
+
```postgresql
108
112
CREATE TABLE contacts (
109
113
contact_id SERIAL,
110
114
first_name VARCHAR NOT NULL,
@@ -118,7 +122,6 @@ CREATE TABLE contacts (
118
122
119
123
One of the following techniques is recommended (in the order of preference) to improve performance when using sequences.
120
124
121
-
122
125
### Option 1. Larger `CACHE` value for `SERIAL`
123
126
124
127
In order to use the `SERIAL` data type and not incur a performance penalty on `INSERT` operations, setting the cache size to 1000 is recommended. This can be achieved in the example table above by running an `ALTER` command on the sequence in the following manner.
@@ -147,7 +150,7 @@ A UUID is a 128-bit quantity that is generated by an algorithm chosen to make it
147
150
148
151
The table shown in the example above should be changed as shown below.
149
152
150
-
```
153
+
```postgresql
151
154
CREATE EXTENSION IF NOT EXISTS pgcrypto;
152
155
153
156
CREATE TABLE contacts (
@@ -162,12 +165,12 @@ CREATE TABLE contacts (
162
165
163
166
## Using `ysql_dump`
164
167
165
-
The PostgreSQL utility, pg_dump can be used to dump the schema of a database. However, this schema would need to be slightly modified as described below.
168
+
The PostgreSQL utility, pg_dump, can be used to dump the schema of a database. However, this schema would need to be slightly modified as described below.
166
169
167
-
The `ysql_dump` tool (which is a YugabyteDBspecific version of the pg_dump tool) can connect to an existing PostgreSQL database and export a YugabyteDB-friendly version of the schema (and therefore includes some of the schema modifications described below). The other changes mentioned below would need to be manually performed since they depend on the use-case.
170
+
The [`ysql_dump`](../../../admin/ysql-dump) tool (a YugabyteDB-specific version of the `pg_dump` tool) can connect to an existing PostgreSQL database and export a YugabyteDB-friendly version of the schema and, therefore, includes some of the schema modifications described below. The other changes mentioned below would need to be manually performed since they depend on the usecase.
168
171
169
172
{{< note title="Note" >}}
170
-
Note that `ysql_dump` has been tested upto PostgreSQL v11.2, it may not work on very new versions of PostgreSQL.
171
-
{{< /note >}}
172
173
174
+
Note that `ysql_dump` has been tested with PostgreSQL versions up to v11.2 and might not work on newer versions of PostgreSQL.
Copy file name to clipboardExpand all lines: docs/content/latest/migrate/migration-process-overview.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
-
title: Migration Process
3
-
headerTitle: Migration Process
4
-
linkTitle: Migration Process
5
-
description: Overview of the migration process.
2
+
title: Migration process overview
3
+
headerTitle: Migration process overview
4
+
linkTitle: Migration process overview
5
+
description: Overview of the process for migrating data and applications from other databases to YugabyteDB.
6
6
menu:
7
7
latest:
8
8
identifier: migration-overview
@@ -12,9 +12,9 @@ isTocNested: true
12
12
showAsideToc: true
13
13
---
14
14
15
-
This page describes the general migration process from various RDBMS to YugabyteDB (YSQL API).
15
+
This page describes the general migration process from other RDBMS to YugabyteDB (YSQL API).
16
16
17
-
The process of migrating to YugabyteDB largely looks similar to the process of migrating an application to PostgreSQL. There are some minor differences between YugabyteDB and PostgreSQL, which are covered in detail in the section on [migrating from PostgreSQL to YugabyteDB](../migrate-from-postgresql). The high-level process of moving from any source database to YugabyteDB is outlined below.
17
+
The process of migrating to YugabyteDB largely looks similar to the process of migrating an application to PostgreSQL. There are some minor differences between YugabyteDB and PostgreSQL, which are covered in detail in [Migrate from PostgreSQL to YugabyteDB](../migrate-from-postgresql). The high-level process of moving from any source database to YugabyteDB is outlined below.
0 commit comments