-
Notifications
You must be signed in to change notification settings - Fork 22
Description
I'm currently testing converting from MySQL to PostgreSQL and I'm not sure if the conversion will be happening correctly.
I have 2 databases on a test server, the first is a clean db that was created following the instructions and then seeded using gitlab-rake. The second database was converted from MySQL and then imported.
If I then dump the schema for both database and compare them I get the following diff summary:
cloud@lyra-pg1:/tmp> diff clean.dmp import.dmp | wc
4603 19380 153709
cloud@lyra-pg1:/tmp>
So a lot of differences. The one thing that jumps out at the moment is:
cloud@lyra-pg1:/tmp> grep trgm clean.dmp
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner:
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner:
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
CREATE INDEX index_issues_on_description_trigram ON issues USING gin (description gin_trgm_ops);
CREATE INDEX index_issues_on_title_trigram ON issues USING gin (title gin_trgm_ops);
CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING gin (description gin_trgm_ops);
CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops);
CREATE INDEX index_milestones_on_description_trigram ON milestones USING gin (description gin_trgm_ops);
CREATE INDEX index_milestones_on_title_trigram ON milestones USING gin (title gin_trgm_ops);
CREATE INDEX index_namespaces_on_name_trigram ON namespaces USING gin (name gin_trgm_ops);
CREATE INDEX index_namespaces_on_path_trigram ON namespaces USING gin (path gin_trgm_ops);
CREATE INDEX index_notes_on_note_trigram ON notes USING gin (note gin_trgm_ops);
CREATE INDEX index_projects_on_description_trigram ON projects USING gin (description gin_trgm_ops);
CREATE INDEX index_projects_on_name_trigram ON projects USING gin (name gin_trgm_ops);
CREATE INDEX index_projects_on_path_trigram ON projects USING gin (path gin_trgm_ops);
CREATE INDEX index_snippets_on_file_name_trigram ON snippets USING gin (file_name gin_trgm_ops);
CREATE INDEX index_snippets_on_title_trigram ON snippets USING gin (title gin_trgm_ops);
CREATE INDEX index_users_on_email_trigram ON users USING gin (email gin_trgm_ops);
CREATE INDEX index_users_on_name_trigram ON users USING gin (name gin_trgm_ops);
CREATE INDEX index_users_on_username_trigram ON users USING gin (username gin_trgm_ops);
cloud@lyra-pg1:/tmp> grep trgm import.dmp
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner:
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner:
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
As you can see the imported dump schema has no trigram indexes and makes me concerned that other items may be missing.
I wonder if a safer approach would be to export the data only, fix up any data issues in the output and then import it into an empty database? The issues I could see would be ensuring an empty database, disabling any foreign keys while importing and the effect of having indexes in place during the import.