From a695424e303b067dabf5ab800f6668c872d2d3a1 Mon Sep 17 00:00:00 2001 From: Andreas Ericsson Date: Wed, 5 May 2010 22:20:26 +0200 Subject: [PATCH] import: Don't bother enabling indexes if we're more than 95% done If we are, it means we're running an incremental import and have either quite a lot of data, most of which is already indexed, or we have a very small set of logfiles and thus don't need to care all that much either way. Signed-off-by: Andreas Ericsson --- import.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/import.c b/import.c index f0de30e..ba87552 100644 --- a/import.c +++ b/import.c @@ -241,6 +241,16 @@ static void disable_indexes(void) return; /* + * if we're more than 95% done before inserting anything, + * such as might be the case when running an incremental + * import, we might as well not bother with disabling + * the indexes, since enabling them again can take quite + * a long time + */ + if (((float)(skipped + imported) / (float)totsize) * 100 >= 95.0) + return; + + /* * We lock the table we'll be working with and disable * indexes on it. Otherwise doing the actual inserts * will take just about forever, as MySQL has to update -- 2.11.4.GIT