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

LOAD DATA INFILE improvements #2271

Closed
robocoder opened this issue Apr 6, 2011 · 2 comments
Closed

LOAD DATA INFILE improvements #2271

robocoder opened this issue Apr 6, 2011 · 2 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. worksforme The issue cannot be reproduced and things work as intended.

Comments

@robocoder
Copy link
Contributor

The current method is:

    function tableInsertBatch($tableName, $fields, $values);
  • Piwik.php: to allow arbitrary file loading, we should refactor the reading & writing into separate methods.
  • ArchiveProcessing.php: bulk insertion stores all the rows in memory before writing to file; perhaps, we could test the LOAD DATA capability beforehand, and if known to be available, write rows concurrently to the infile
  • there are MySQL tuning parameters that users may not be able to change, but might want to be aware of (via FAQ?), e.g., bulk_insert_buffer_size, and key_buffer_size

Question(s):

  • how well does the new code perform for users who have changed the storage engine to InnoDB?
  • there are multiple indices on the archive tables; for a non-empty table, should we be using:
ALTER TABLE $tableName DISABLE KEYS;
LOAD DATA INFILE $path REPLACE INTO  $tableName ...etc...;
ALTER TABLE $tableName ENABLE KEYS;
@mattab
Copy link
Member

mattab commented Apr 6, 2011

ALTER TABLE $tableName DISABLE KEYS;

Not necessary, Mysql will automatically disable keys before and build the index once all have been inserted.

I also think the code could be improved, however to really do it properly we need to understand where the memory grows and how it will minimize it. I propose we postpone this work until later on where a script will help us assess the memory limitations of Archiving (kind of #766 )

@mattab
Copy link
Member

mattab commented Sep 23, 2013

see this FAQ load data in file piwik

@robocoder robocoder added this to the Future releases milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

2 participants