mysql - SELECT ... FOR UPDATE locking trouble when applied on date range -



i'm having following table structure.

  reservation: (innodb)   ------------------------------------------   id int,   date date,   item_id int,   slot varchar(50);   primary key(id), unique key(item_id,date). 

now i'm trying use select.....for update on reservation table inside transaction lock specific rows within date range(eg:2012-06-15 2012-06-16) of particular item_id.

select availability reservation item_id={$item_id} , (date>='{$to_date}' , date<='{$from_date}') update 

now when use above statement, blocking rows of particular item_id beyond date range.i'm using unique key(item_id,date).

how lock particular date range of specific item_id?

regards,
ravi.

added:

 | ===================================== 120615 20:14:13 innodb monitor output ===================================== per second averages calculated last 24 seconds ---------- semaphores ---------- os wait array info: reservation count 12, signal count 12 mutex spin waits 0, rounds 180, os waits 4 rw-shared spins 10, os waits 5; rw-excl spins 2, os waits 2 ------------ transactions ------------ trx id counter 0 15147 purge done trx's n:o < 0 15136 undo n:o < 0 0 history list length 2 total number of lock structs in row lock hash table 2 list of transactions each session: ---transaction 0 0, not started, os thread id 2940 mysql thread id 76, query id 1487 localhost 127.0.0.1 root show innodb status ---transaction 0 15143, not started, os thread id 2588 mysql thread id 10, query id 578 localhost 127.0.0.1 root ---transaction 0 15144, active 11526 sec, os thread id 2740 3 lock struct(s), heap size 320 mysql thread id 11, query id 577 localhost 127.0.0.1 root -------- file i/o -------- i/o thread 0 state: wait windows aio (insert buffer thread) i/o thread 1 state: wait windows aio (log thread) i/o thread 2 state: wait windows aio (read thread) i/o thread 3 state: wait windows aio (write thread) pending normal aio reads: 0, aio writes: 0,  ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 pending flushes (fsync) log: 0; buffer pool: 0 187 os file reads, 75 os file writes, 29 os fsyncs 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s ------------------------------------- insert buffer , adaptive hash index ------------------------------------- ibuf: size 1, free list len 0, seg size 2, 0 inserts, 0 merged recs, 0 merges hash table size 62383, used cells 0, node heap has 1 buffer(s) 0.00 hash searches/s, 0.00 non-hash searches/s --- log --- log sequence number 0 8287163 log flushed   0 8287163 last checkpoint @  0 8287163 0 pending log writes, 0 pending chkp writes 24 log i/o's done, 0.00 log i/o's/second ---------------------- buffer pool , memory ---------------------- total memory allocated 23277934; in additional pool allocated 1430400 buffer pool size   960 free buffers       895 database pages     64 modified db pages  0 pending reads 0 pending writes: lru 0, flush list 0, single page 0 pages read 64, created 0, written 51 0.00 reads/s, 0.00 creates/s, 0.00 writes/s buffer pool hit rate 1000 / 1000 -------------- row operations -------------- 0 queries inside innodb, 0 queries in queue 1 read views open inside innodb main thread id 1544, state: waiting server activity number of rows inserted 10, updated 0, deleted 0, read 66 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s ---------------------------- end of innodb monitor output ============================  | 


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -