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
운영게시판
최근게시물
Informix Q&A 2554 게시물 읽기
No. 2554
유용한 query 두번째..
작성자
작은거
작성일
2008-12-10 15:25:54
조회수
5,752

What is the current version of the engine
  select owner
          from sysmaster:systables .
          where tabid = 99


How to list the users
  select unique username
          from  syssessions

 

What is the disk IO for a session
  select syssesprof.sid,
          isreads,
          iswrites,
          isrewrites,
          isdeletes
          from syssesprof, syssessions 
          where syssesprof.sid = syssessions.sid


How to convert a PID to a session ID
  select sid
          fromsyssessions
          where pid = 'pid'

 

How to find the sequential scans for a table
  select dbsname, tabname, seqscans
          from sysptprof;

 


How to list the logging status of a database
  select name,
          is_logging,
          is_buff_log,
          is_ansi,
          is_nls
          from sysdatabases

  The flags are:
          0:  Not logged
          1:  Buffered Logging
          2:  Unbuffered Logging
          4:  Ansi
          8:  NLS

 

How to list the locks
  select dbsname,
          tabname,
          rowidlk,
          keynum,
          type 
          from syslocks,
          syssessions
          where owner = "sid"
         
       
      B   Byte lock
      IS  Intent shared lock
      S   Shared lock
      XS  Repeatable read shared lock
      U   Update lock
      IX  Intent exclusive lock
      SIX Shared intent exclusive
      X   Exclusive lock
      XR  Repeatble read exclusive

 

How to list the database locks
SELECT "database lock" table_name, l.type lock_type, l.keynum index_num,
  HEX(l.rowidlk) rowid, s.sid session_id, s.username, s.pid, s.hostname,
  q.sqs_statement statement
FROM syslocks l, sysdatabases d, syssessions s, syssqlstat q
WHERE d.name = ' database_name '
  AND l.rowidlk = d.rowid
  AND l.owner = s.sid
  AND dbsname = 'sysmaster'
  AND tabname = 'sysdatabases'
  AND s.sid = q.sqs_sessionid 
 

UNION ALL

SELECT l.tabname, l.type, l.keynum, HEX(l.rowidlk), s.sid, s.username,
  s.pid, s.hostname, q.sqs_statement
FROM syslocks l, syssessions s, syssqlstat q
WHERE l.dbsname = ' database_name '
  AND l.owner = s.sid
  AND s.sid = q.sqs_sessionid
  AND dbsname = 'sysmaster'
  AND tabname = 'sysdatabases'
ORDER BY 5;

[Top]
No.
제목
작성자
작성일
조회
2557oninit -PHY 설명좀 부탁드려요 [2]
장나라
2008-12-18
4234
2556DBVisualizer 설치하여 써보신분 !!! [1]
지원요청
2008-12-18
6259
2555[질문]ibatis에서 인포믹스 text형 insert처리방법 [1]
이진홍
2008-12-10
5959
2554유용한 query 두번째..
작은거
2008-12-10
5752
2552두개의 on_servername 사용하기 [1]
달팽이
2008-12-03
4126
2551crontab 관련 mail 질문입니다.
홍순범
2008-12-01
4095
2550informix에서 요일 월을 영문으로 받아오는 방법좀 가르쳐주세요.
난몰까
2008-11-30
4774
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2017 DSN, All rights reserved.
작업시간: 0.074초, 이곳 서비스는
	PostgreSQL v9.6.3으로 자료를 관리합니다