Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 907 Bytes

mysql.md

File metadata and controls

44 lines (31 loc) · 907 Bytes

MySql

  1. connection pooling
  2. server variables
  3. limit the result
  4. date time

server variables

show variables like 'max_connections'
select @@global.net_write_timeout;
select @@global.net_read_timeout;
select @@global.wait_timeout;
select @@global.connect_timeout;

connection pooling

## check pool size
show variables like 'max_connections'

## set in connection string
Server=server;Port=3306;Database=db;Uid=uid;Pwd=pwd;Allow User Variables=True;maximumpoolsize=200

limit the result

SELECT * FROM tbl_foo WHERE name = 'sarmen' LIMIT 1

date time

SELECT * FROM JobLinkQueue 
   WHERE (BrandIndex = @brandId AND Status = 1)
      OR (BrandIndex = @brandId AND Status = 2 AND BookingDate < NOW() - INTERVAL 10 MINUTE)
  ORDER BY Status, `Index` LIMIT 1