database.sarang.net
UserID
Passwd
Database
DBMS
ㆍMySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
MySQL Q&A 30283 게시물 읽기
No. 30283
select 시에 락(?)이 걸립니다.
작성자
김영범(bumworld)
작성일
2012-07-12 11:21
조회수
8,771

 

centos : 5.2

mysql : 5.5.11

was : tomcat 6.0

 

특정 쿼리에서 where 조건의 값이 특정한 값일때 락이 걸립니다.

계속 동일한 쿼리에서만 문제가 생기는데요.

insert나 delete가 아닌 select 시에 발생을 합니다.

SHOW ENGINE INNODB STATUS;로 해서 보면 아래와 같이 걸린 로그가 보입니다.

이게 락이 걸린게 맞는건가요?

아래 쿼리에 짤린 부분이 있는데 select에 아래 쿼리를 추가 하고서 발생했습니다.

아래 부분을 제거하면 정상적으로 호출이 가능 하구요.

 

, case when b.parent_no > 0 then

(select

case

when LENGTH(substring(htmlStrip(contents), 1, 15)) = 0

then get_code_name('006', checkin_type)

else substring(htmlStrip(contents), 1, 15) end

from tb_talking where talking_no = b.parent_no

)

else '' end as parent_title

 

계속 걸려 있는걸 풀려면 어떻게 해야 하나요?

그리고 어떤 문제 때문에 발생하는지도 궁금 합니다.

조언 부탁드립니다.

 

 

------------

TRANSACTIONS

------------

Trx id counter 97E40A

Purge done for trx's n:o < 97DA87 undo n:o < 0

History list length 1052

LIST OF TRANSACTIONS FOR EACH SESSION:

---TRANSACTION 97E384, not started, process no 3408, OS thread id 1241823552

MySQL thread id 138, query id 1356907629 localhost 127.0.0.1 subway

---TRANSACTION 0, not started, process no 3408, OS thread id 1242089792

MySQL thread id 32, query id 1416738236 localhost root

SHOW ENGINE INNODB STATUS

---TRANSACTION 97E408, not started, process no 3408, OS thread id 1241291072

MySQL thread id 19, query id 1414440545 localhost 127.0.0.1 didueattherat

---TRANSACTION 97E407, not started, process no 3408, OS thread id 1240492352

MySQL thread id 10, query id 1414137099 localhost 127.0.0.1 didueattherat

---TRANSACTION 97DA85, ACTIVE 2499 sec, process no 3408, OS thread id 1241024832

mysql tables in use 11, locked 0

MySQL thread id 16, query id 1416738300 localhost 127.0.0.1 subway

                select

                        b.talking_no

                        , b.parent_type

                        , b.line_no

                        , (select concat(city_type, '_', line_code) from tb_line where line_no = b.line_no) as city_line

                        , b.contents

                        , b.ip_address

                        , date_format(b.regist_date, '%Y?%m?%d? %H:%i:%S') as regist_date

                        , date_format(b.regist_date, '%Y%m%d%H%i%S') as regist_date2

                        , b.user_no

                        , b.reply_cnt

                        , (select user_name from tb_user where user_no = b.user_no) as user_name

                        , get_user_photo(b.user_no) as user_profile_path

                        , a.station_name

from

tb_talking b

 

Trx read view will not see trx with id >= 97DA86, sees < 97DA86

--------

FILE I/O

--------

I/O thread 0 state: waiting for completed aio requests (insert buffer thread)

I/O thread 1 state: waiting for completed aio requests (log thread)

I/O thread 2 state: waiting for completed aio requests (read thread)

I/O thread 3 state: waiting for completed aio requests (read thread)

I/O thread 4 state: waiting for completed aio requests (read thread)

I/O thread 5 state: waiting for completed aio requests (read thread)

I/O thread 6 state: waiting for completed aio requests (write thread)

I/O thread 7 state: waiting for completed aio requests (write thread)

I/O thread 8 state: waiting for completed aio requests (write thread)

I/O thread 9 state: waiting for completed aio requests (write thread)

Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,

 ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0

Pending flushes (fsync) log: 0; buffer pool: 0

3532 OS file reads, 9019 OS file writes, 1771 OS fsyncs

 

이 글에 대한 댓글이 총 2건 있습니다.

 

저거.. 쿼리가 좀 이상한게

 

1건 나와야 되는데.. 여러건 나올거 같은데여

 

case 문을 저렇게도 쓰나여? -ㅇ-;; 이상하네~

민족님이 2012-07-12 12:36에 작성한 댓글입니다. Edit

talking_no가 키라서  case문의 데이타는 한건이 나옵니다.

contents가 빈 내용이면 checkin type으로 데이타를 뽑고

conetns 내용이 있으면 앞에 15자리만 가져오게 했습니다.

김영범(bumworld)님이 2012-07-12 13:05에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
30288Cygwin 에 mysql 설치 시 질문 입니다. [1]
십년만에
2012-07-18
9312
30287use index 사용하기 [1]
태양
2012-07-17
9833
30285데이타베이스 백업 어떻게 하는지 좀 알려주세요!
이정환
2012-07-15
7507
30283select 시에 락(?)이 걸립니다. [2]
김영범
2012-07-12
8771
30280쿼리좀 봐주세여. [1]
장학우
2012-07-10
8155
30279정렬방법에 대해 문의 드립니다~ [8]
김대영
2012-07-03
8106
30278쿼리질문입니다. [2]
쿼리질문
2012-07-01
7699
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.019초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다