Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got a 7GB pgsql dump #23

Open
SubZero5 opened this issue Nov 18, 2019 · 5 comments
Open

Got a 7GB pgsql dump #23

SubZero5 opened this issue Nov 18, 2019 · 5 comments

Comments

@SubZero5
Copy link

SubZero5 commented Nov 18, 2019

Hi there,

I have got a 7.7GB pgsql dump file to be switched into a mysql dump.

However my PHP memory limit is 512MB and my system RAM is 4GB with currently 700MB free.

How can we split the parsing so that pg2mysql divides the mysql dumps into various number of parts?

COPY cn (id, did, fid, l, m, ff, g, by, db, id_rc, id_rd, ac, ad, an, sa, dn, misc) FROM stdin;
... multiple
... lines
... of
... loooong
... data
... here
\.

@ChrisLundquist
Copy link
Owner

ChrisLundquist commented Nov 18, 2019 via email

@ChrisLundquist
Copy link
Owner

ChrisLundquist commented Nov 18, 2019 via email

@nise
Copy link

nise commented Aug 9, 2022

Even with 16RM On line 24 in pg2mysql.inc.php I saw
ini_set("memory_limit", "512M"); which I tried to increase to ini_set("memory_limit", "7G");.

Finally the script stops at line 419 where the resulting MySQL code is contaminated in a very long string to be returned later. This is causes the error:

PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 241600600 bytes) in /Volumes/DATA0/nise/Documents/proj_002_aple/FernUniDaten/moodle-exporter/pg2mysql/pg2mysql.inc.php on line 419

See also https://www.airpair.com/php/fatal-error-allowed-memory-size

@bayshades
Copy link

i have 16 gig ram but im stuck at this screen for 30 minutes and still waiting
image

@alneo
Copy link

alneo commented Jun 2, 2024

to convert big file, change file pg2mysql.inc.php
...
+$COPY = ''; $COPY_str=0; $COPY_maxrec = 500;
while ($instr=fgets($infp)) {
...
+if(strpos($instr, "COPY")!==false) { $COPY = $instr; $COPY_str=0; }
$pgsqlchunk[]=$instr;
+$COPY_str++;
...
if (
$progress == 1.0 ||
(strlen($instr)>3 && ($instr[$len-3]==")" && $instr[$len-2]==";" && $instr[$len-1]=="\n") && $inquotes==false) ||

  •  $COPY_str==$COPY_maxrec
    
    ) {
    +if($COPY_str==$COPY_maxrec) $pgsqlchunk[]= "\.\n";
    $chunkcount++;
    ...
    $pgsqlchunk=array();
    +if($COPY_str==$COPY_maxrec) {
  • $pgsqlchunk[]= $COPY;
  • $COPY_str=0;
    +}
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants