SCM

Forum: feature_requests

Monitor Forum | Start New Thread Start New Thread
preserve multiple-row insert (extended insert [ reply ]
By: Catherine Devlin on 2011-04-25 14:03
[forum:1014380]
These days, postgreSQL supports multiple-row insert, the type generated by mysqldump --extended-insert. mysql2pgsql.perl breaks those into individual inserts, but it's much faster not to break it up.

Here's a patch with a new --preserve_multi_insert option allowing those multi-row inserts to be retained.

Thanks!

64c64
< my( $ENC_IN, $ENC_OUT, $PRESERVE_CASE, $HELP, $DEBUG, $SCHEMA, $LOWERCASE, $CHAR2VARCHAR, $NODROP, $SEP_FILE, $opt_debug, $opt_help, $opt_schema, $opt_preserve_case, $opt_char2varchar, $opt_nodrop, $opt_sepfile, $opt_enc_in, $opt_enc_out );
---
> my( $ENC_IN, $ENC_OUT, $PRESERVE_CASE, $HELP, $DEBUG, $SCHEMA, $LOWERCASE, $CHAR2VARCHAR, $NODROP, $SEP_FILE, $PRESERVE_MULTI_INSERT, $opt_debug, $opt_help, $opt_schema, $opt_preserve_case, $opt_char2varchar, $opt_nodrop, $opt_sepfile, $opt_enc_in, $opt_enc_out, $opt_preserve_multi_insert);
213c213
< GetOptions("help", "debug"=> \$opt_debug, "schema=s" => \$SCHEMA, "preserve_case" => \$opt_preserve_case, "char2varchar" => \$opt_char2varchar, "nodrop" => \$opt_nodrop, "sepfile=s" => \$opt_sepfile, "enc_in=s" => \$opt_enc_in, "enc_out=s" => \$opt_enc_out );
---
> GetOptions("help", "debug"=> \$opt_debug, "schema=s" => \$SCHEMA, "preserve_case" => \$opt_preserve_case, "char2varchar" => \$opt_char2varchar, "nodrop" => \$opt_nodrop, "preserve_multi_insert" => \$opt_preserve_multi_insert, "sepfile=s" => \$opt_sepfile, "enc_in=s" => \$opt_enc_in, "enc_out=s" => \$opt_enc_out );
216a217
> $PRESERVE_MULTI_INSERT = $opt_preserve_multi_insert || 0;
234c235,238
< print "\t--char2varchar: converts all char fields to varchar\n";
---
> print "\t--preserve_multi_insert: prevents automatic conversion of multiple (extended) insert to simple\n";
> print "\t\tIf your version of PostgreSQL supports multi-insert and you used mysqldump --extended-insert,\n";
> print "\t\tthis will greatly speed up population of the tables.\n";
> print "\t--char2varchar: converts all char fields to varchar\n";
868c872
<
---
>
871c875
< if (@rows > 1)
---
> if (($PRESERVE_MULTI_INSERT == 0) and (@rows > 1))

Powered By FusionForge