Bonjour à tous.

Je travaille actuellement sur une application Java qui attaque une bd MySQL 5.0 avec des tables uniquement InnoDB.

Pour mettre en place le schema BD, nous utilisons un script de ce style

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
 
 
SET FOREIGN_KEY_CHECKS = 0;
 
 
--
-- Création des tables
--
 
CREATE TABLE T_AN_CO (
       SITE_NAME          VARCHAR(40) NOT NULL,
       ANT_NAME           VARCHAR(40) NOT NULL,
       COV_CODE           VARCHAR(15) NOT NULL
) TYPE=INNODB;
 
 
.
.
.
 
--
-- Définition des PKs
--
ALTER TABLE T_AN_CO
       ADD  ( PRIMARY KEY (SITE_NAME) ) ;
 
 
.
.
.
 
--
-- Définition des FKs
--
 
ALTER TABLE T_AN_CO
	   ADD CONSTRAINT fk_ant_contid FOREIGN KEY (COV_CODE)
	   						 REFERENCES T_ANOTHER_TABLE(COV_CODE) ;
 
.
.
.
 
--
-- Définitions des colonnes auto-incrémentées
--
 
ALTER TABLE T_ANOTHER_TABLE MODIFY COLUMN ATTEN_ID INTEGER NOT NULL AUTO_INCREMENT;
 
 
.
.
.
 
--
-- Définition des indexs
--
 
CREATE INDEX IND_CALRES_CAL_ID_DATE ON T_RESULTS
(
       CAL_ID                         ,
       CALRES_DATE
);
 
.
.
.
 
SET FOREIGN_KEY_CHECKS = 1;

Avec, à peu prés :

- 60 Tables
- 60 Pks définies
- 30 colonnes auto incrémentées
- 50 FKs
- 10 indexs


J'ai récemment changé de Pc de dev'.

Sur mon ancien pc de dev', ce script mettait au max 10 secondes pour s'exécuter (un 2x Proc, 2Go de Ram, DD 7200, win Xp).

J'ai eu un nouveau pc de dev' (4x Proc, 4Go de ram, DD SATA 7200, win 7 32Bits) : résultat, au minimum ce script s'exécute en 50 secondes.

Très étrange car toutes les autres tâches du projet s'exécute bcp plus rapidement, et même les accès (select, update et Cie) sur la BD, sont très rapides.

Ça me gène pas vraiment, mais je dois avouer que ça me turlupine. Je vous colle mon my.cnf :

# CLIENT SECTION
# ----------------------------------------------------------------------
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.

[client]
port = 3306

[mysql]
default-character-set=latin1


# SERVER SECTION
# ----------------------------------------------------------------------
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.

[mysqld]

# priority to select queries
max_write_lock_count = 1

# no table locks - innodb auto management
innodb_table_locks = off

# Generic configuration options >---------------------------------------

# The TCP/IP Port the MySQL Server will listen on
port = 3306

# Path to installation directory.
# All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"

# Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"

# The default character set that will be used when a new schema or table
# is created and no character set is defined
default-character-set=latin1

# The default storage engine that will be used when create new tables
default-storage-engine=INNODB


# Others options >------------------------------------------------------

# back_log is the number of connections the operating system can keep in
# the listen queue, before the MySQL connection manager thread has
# processed them. If you have a very high connection rate and experience
# "connection refused" errors, you might need to increase this value.
# Check your OS documentation for the maximum value of this parameter.
# Attempting to set back_log higher than your operating system limit
# will have no effect.
back_log = 50

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections = 100

# Maximum amount of errors allowed per host. If this limit is reached,
# the host will be blocked from connecting to the MySQL server until
# "FLUSH HOSTS" has been run or the server was restarted. Invalid
# passwords and other errors during the connect phase result in
# increasing this value. See the "Aborted_connects" status variable for
# global counter.
max_connect_errors = 10

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache = 256

# The maximum size of a query packet the server can handle as well as
# maximum query size server can process (Important when working with
# large BLOBs). enlarged dynamically, for each connection.
max_allowed_packet = 16M

# The size of the cache to hold the SQL statements for the binary log
# during a transaction. If you often use big, multi-statement
# transactions you can increase this value to get more performance. All
# statements from transactions are buffered in the binary log cache and
# are being written to the binary log at once after the COMMIT. If the
# transaction is larger than this value, temporary file on disk is used
# instead. This buffer is allocated per connection on first update
# statement in transaction
binlog_cache_size = 1M

# Maximum allowed size for a single HEAP (in memory) table. This option
# is a protection against the accidential creation of a very large HEAP
# table which could otherwise use up all memory resources.
max_heap_table_size = 64M

# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
# queries. If sorted data does not fit into the sort buffer, a disk
# based merge sort is used instead - See the "Sort_merge_passes"
# status variable. Allocated per thread if sort is needed.
sort_buffer_size = 8M

# This buffer is used for the optimization of full JOINs (JOINs without
# indexes). Such JOINs are very bad for performance in most cases
# anyway, but setting this variable to a large value reduces the
# performance impact. See the "Select_full_join" status variable for a
# count of full JOINs. Allocated per thread if full join is found
join_buffer_size = 9M

# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before. This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size = 64

# This permits the application to give the threads system a hint for the
# desired number of threads that should be run at the same time. This
# value only makes sense on systems that support the thread_concurrency()
# function call (Sun Solaris, for example).
# You should try [number of CPUs]*(2..4) for thread_concurrency
thread_concurrency = 4

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size = 256M

# Only cache result sets that are smaller than this limit. This is to
# protect the query cache of a very large result set overwriting all
# other query results.
query_cache_limit = 2M

# Minimum word length to be indexed by the full text search index.
# You might wish to decrease it if you need to search for shorter words.
# Note that you need to rebuild your FULLTEXT index, after you have
# modified this value.
ft_min_word_len = 4

# Thread stack size to use. This amount of memory is always reserved at
# connection time. MySQL itself usually needs no more than 64K of
# memory, while if you use your own stack hungry UDF functions or your
# OS requires more stack for some operations, you might need to set this
# to a higher value.
thread_stack = 192K

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size = 192M

# All queries taking more than this amount of time (in seconds) will be
# trated as slow. Do not use "1" as a value here, as this will result in
# even very fast queries being logged from time to time (as MySQL
# currently measures time with second accuracy only).
long_query_time = 2


# MyISAM Specific options >---------------------------------------------

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size = 32M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size = 2M

# When reading rows in sorted order after a sort, the rows are read
# through this buffer to avoid disk seeks. You can improve ORDER BY
# performance a lot, if set this to a high value.
# Allocated per thread, when needed.
read_rnd_buffer_size = 16M

# MyISAM uses special tree-like cache to make bulk inserts (that is,
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster. This variable limits the size of the cache tree in
# bytes per thread. Setting it to 0 will disable this optimisation. Do
# not set it larger than "key_buffer_size" for optimal performance.
# This buffer is allocated when a bulk insert is detected.
bulk_insert_buffer_size = 32M

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
myisam_sort_buffer_size = 64M

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size = 10G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size = 10G

# If a table has more than one index, MyISAM can use more than one
# thread to repair them by sorting in parallel. This makes sense if you
# have multiple CPUs and plenty of memory.
myisam_repair_threads = 1


# INNODB Specific options >---------------------------------------------

# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size = 1200M

# InnoDB stores data in one or more data files forming the tablespace.
# If you have a single logical drive for your data, a single
# autoextending file would be good enough. In other cases, a single file
# per device is often a good choice. You can configure InnoDB to use raw
# disk partitions as well - please refer to the manual for more info
# about this.
innodb_data_file_path = ibdata1:20G

# Number of IO threads to use for async IO operations. This value is
# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
# larger number.
innodb_file_io_threads = 4

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency = 8

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit = 0

# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size = 8M

# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size = 512M

# Total number of files in the log group. A value of 2-3 is usually good
# enough.
innodb_log_files_in_group = 3

# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
# If it is reached, InnoDB will start flushing them out agressively to
# not run out of clean pages at all. This is a soft limit, not
# guaranteed to be held.
innodb_max_dirty_pages_pct = 90

# How long an InnoDB transaction should wait for a lock to be granted
# before being rolled back. InnoDB automatically detects transaction
# deadlocks in its own lock table and rolls back the transaction. If you
# use the LOCK TABLES command, or other transaction-safe storage engines
# than InnoDB in the same transaction, then a deadlock may arise which
# InnoDB cannot notice. In cases like this the timeout is useful to
# resolve the situation.
innodb_lock_wait_timeout = 120


#Enter a name for the error log file. Otherwise a default name will be used.
log-error=izard.err

# This variable controls how to delay INSERT, UPDATE and DELETE operations when
# the purge operations are lagging (see Section 13.2.13, “Implementation of Multi-Versioning”).
#
# The default value of this variable is 0, meaning that there are no delays.
# innodb_max_purge_lag is available as of MySQL 4.0.22 and 4.1.6.
#
# The InnoDB transaction system maintains a list of transactions that have delete-marked
# index records by UPDATE or DELETE operations. Let the length of this list be purge_lag.
# When purge_lag exceeds innodb_max_purge_lag, each INSERT, UPDATE and DELETE operation is
# delayed by ((purge_lag/innodb_max_purge_lag)×10)–5 milliseconds. The delay is computed
# in the beginning of a purge batch, every ten seconds. The operations are not delayed if
# purge cannot run because of an old consistent read view that could see the rows to be purged.
#
# A typical setting for a problematic workload might be 1 million, assuming that our transactions
# are small, only 100 bytes in size, and we can allow 100MB of unpurged rows in our tables.
innodb_max_purge_lag=1000000

[mysqldump]

# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick

# Maximum size of blob in eCSM database = medium blob (=16 Mo)
max_allowed_packet = 16M


[mysql]

no-auto-rehash


[isamchk]

key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M


[myisamchk]

key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M


[mysqlhotcopy]

interactive-timeout


[mysqld_safe]

# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192

Si vous avez des idées, pouvant expliquer ce soucis, je suis preneur.
Merci.

[Edit] J'ai oublié de préciser, mon cdp a eu un nouveau pc sous win 7 aussi, avec la même version de MySQL, et le script prends au max 10 secondes à s'exécuter, j'aurais bien incriminé win 7 mais même pas... [/Edit]