update语句explian了吗?where后面的条件字段有索引吗?
解决方案 »
- 连接mysql数据库时。出现这样的错误: No suitable driver
- 如何在mysql同一用户的两个数据库之间移动表
- $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file --bind-addres
- 如何快速找出丢失数据?
- 大家帮我看看这条Update语句的错误在哪里???
- 请问可以这样查询mysql数据库吗?
- 请问在数据库中查出日期为最新的两条记录的Sql语句应该怎样来写?
- 请教一个二进制运算的问题。
- linux 卸载 mysql的问题
- 中文乱码
- MySQL的or语句有没有类似短路求值的特性?
- MySQL-front 和MySQL崩溃
UPDATE XX set y=‘1’,x='12',ip='120.0.0.1' where id =1; 只有单纯的这一句mysql_query(&mysql,"UPDATE XX set y=‘1’,x='12',ip='120.0.0.1' where id =1"); 在我C里面我就这么写的show create table 至于这个 我刚学 也不是太懂 我用的是 navicat 创建的数据库列表的
UPDATE XX set y=‘1’,x='12',ip='120.0.0.1' where id =‘1’; mysql_query(&mysql,"UPDATE XX set y=‘1’,x='12',ip='120.0.0.1' where id =‘1’"); //1的引号忘加了 程序里有的 我怕误会就再回复了一次。
否则以(id, x, y, ip)这些列建一个索引试试
速度应该会快些
另外检查一下 my.ini 中ibdata1 的设置是什么。
没有设置 那就是默认的吧!贴出以供分析。idata1 文件大小18MB 18432KB...[client]
no-beep
port=3306
[mysql]
default-character-set=utf8
[mysqld]
port=3306
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/data\"
character-set-server=utf8
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
log-output=NONE
general-log=0
general_log_file="LQO58GN3LZDRV0R.log"
slow-query-log=0
slow_query_log_file="LQO58GN3LZDRV0R-slow.log"
long_query_time=10
log-error="LQO58GN3LZDRV0R.err"
max_connections=100
query_cache_size=0
table_cache=1024
tmp_table_size=15M
thread_cache_size=64
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=28M
key_buffer_size=8M
read_buffer_size=4M
read_rnd_buffer_size=16M
sort_buffer_size=256K
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=74M
innodb_log_file_size=38M
innodb_thread_concurrency=17
innodb_flush_log_at_trx_commit=0
innodb_autoextend_increment=64M
innodb_log_buffer_size=16M
event_scheduler=1
table_open_cache=1024
就是UPDATE的执行时间 会在
>0.01秒 到 0.2秒左右浮动 但是频繁的出现0.176秒 //我每0.01秒执行一次UPDATE IBDATA文件 没有增长过是我my.ini哪里设置错了么?我每次更新2个数据也是这样的结果 1个数据也是这样的结果
左边是函数的内容
右边是 测试出的时间
就更新两个数据 用了 0.06秒
如果大量的使用这个函数
我想应该会跟我开头说的一样 浮动在 0.2秒以下 非常频繁 我用程序测试了一下0.01秒循环更新数据 最慢的目前测试出是0.2秒
[client]
no-beepport=3307[mysql]default-character-set=utf8[mysqld]port=3307datadir="C:/ProgramData/MySQL/MySQL Server 5.7/data\"character-set-server=utf8default-storage-engine=InnoDBsql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"log-output=NONE
general-log=0
general_log_file="LQO58GN3LZDRV0R.log"
slow-query-log=0
slow_query_log_file="LQO58GN3LZDRV0R-slow.log"
long_query_time=10log-error="LQO58GN3LZDRV0R.err"max_connections=151query_cache_size=128M
query_cache_type=1table_open_cache=2000tmp_table_size=16Mthread_cache_size=10myisam_max_sort_file_size=100Gmyisam_sort_buffer_size=24Mkey_buffer_size=8Mread_buffer_size=48K
read_rnd_buffer_size=256Ksort_buffer_size=256Kinnodb_flush_log_at_trx_commit=1innodb_log_buffer_size=1Minnodb_buffer_pool_size=8Minnodb_log_file_size=48Minnodb_thread_concurrency=17tablespace file when it becomes full.
innodb_autoextend_increment=64innodb_buffer_pool_instances=8innodb_concurrency_tickets=5000there after its first access beforeinnodb_old_blocks_time=1000minimum value is 10.
innodb_open_files=300innodb_stats_on_metadata=0# When innodb_file_per_table is enabled (the default in 5.6.6 and higher), InnoDB stores the data and indexes for each newly created table
# in a separate .ibd file, rather than in the system tablespace.
innodb_file_per_table=1# Use the following list of values: 0 for crc32, 1 for strict_crc32, 2 for innodb, 3 for strict_innodb, 4 for none, 5 for strict_none.
innodb_checksum_algorithm=0# The number of outstanding connection requests MySQL can have.
# This option is useful when the main MySQL thread gets many connection requests in a very short time.
# It then takes some time (although very little) for the main thread to check the connection and start a new thread.
# The back_log value indicates how many requests can be stacked during this short time before MySQL momentarily
# stops answering new requests.
# You need to increase this only if you expect a large number of connections in a short period of time.
back_log=80# If this is set to a nonzero value, all tables are closed every flush_time seconds to free up resources and
# synchronize unflushed data to disk.
# This option is best used only on systems with minimal resources.
flush_time=0# The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use
# indexes and thus perform full table scans.
join_buffer_size=256K# The maximum size of one packet or any generated or intermediate string, or any parameter sent by the
# mysql_stmt_send_long_data() C API function.
max_allowed_packet=4M# If more than this many successive connection requests from a host are interrupted without a successful connection,
# the server blocks that host from performing further connections.
max_connect_errors=100# Changes the number of file descriptors available to mysqld.
# You should try increasing the value of this option if mysqld gives you the error "Too many open files".
open_files_limit=4161# Set the query cache type. 0 for OFF, 1 for ON and 2 for DEMAND.
query_cache_type=0# If you see many sort_merge_passes per second in SHOW GLOBAL STATUS output, you can consider increasing the
# sort_buffer_size value to speed up ORDER BY or GROUP BY operations that cannot be improved with query optimization
# or improved indexing.
sort_buffer_size=256K# The number of table definitions (from .frm files) that can be stored in the definition cache.
# If you use a large number of tables, you can create a large table definition cache to speed up opening of tables.
# The table definition cache takes less space and does not use file descriptors, unlike the normal table cache.
# The minimum and default values are both 400.
table_definition_cache=1400# Specify the maximum size of a row-based binary log event, in bytes.
# Rows are grouped into events smaller than this size if possible. The value should be a multiple of 256.
binlog_row_event_max_size=8K# If the value of this variable is greater than 0, a replication slave synchronizes its master.info file to disk.
# (using fdatasync()) after every sync_master_info events.
sync_master_info=10000# If the value of this variable is greater than 0, the MySQL server synchronizes its relay log to disk.
# (using fdatasync()) after every sync_relay_log writes to the relay log.
sync_relay_log=10000# If the value of this variable is greater than 0, a replication slave synchronizes its relay-log.info file to disk.
# (using fdatasync()) after every sync_relay_log_info transactions.
sync_relay_log_info=10000innodb_flush_log_at_trx_commit=0
这个事我的my.ini文件 几乎没怎么改过吧。
query_cache_size=128M
query_cache_type=1
innodb_flush_log_at_trx_commit=0
这是我百度提高性能 尝试修改的 除了最后一条 其他都没有明显的效果。