2020년 2월 24일 월요일

Costs Associated with Indexes


Costs Associated with Indexes

Indexes entail certain costs. Memory consumption and incremental maintenance are two major cost factors that need to be considered.

Memory Consumption

To store the mapping information of value IDs to records, each index uses an inverted list that needs to be kept in main memory. This list typically requires an amount of memory that is of the same order of magnitude as the index vector of the corresponding attribute. When creating a concatenated index (for more information, see above), there is even more overhead because an additional dictionary containing the concatenated values of all participating columns needs to be created as well. It is difficult to estimate the corresponding overhead, but it is usually notably higher than the summed-up size of the dictionaries of the participating columns. Therefore, concatenated indexes should be created with care.
The memory needed for inverted individual indexes includes the memory for inverted indexes on all indexed columns. This memory usage can be queried as a sum of M_CS_COLUMNS.MEMORY_SIZE_INDEX for all indexed columns.
The main advantage of the inverted individual index is its low memory footprint. The memory needed for inverted individual indexes is much smaller than the memory used for the internal index key column that is required for inverted value and inverted hash indexes. In addition, the data and log I/O overhead, table load time, CPU needed for the delta merge, and the overhead of DML update operations are also reduced because an internal column does not need to be maintained. Similarly, the DDL to create an inverted individual index is also much faster than for the other index types because the concatenated string does not need to be generated.

Incremental Maintenance

Whenever a DML operation is performed on the base table, the corresponding index structures need to be updated as well (for example, by inserting or deleting entries). These additional maintenance costs add to the costs on the base relation, and, depending on the number of indexes created, the number of attributes in the base table, and the number of attributes in the individual indexes, might even dominate the actual update time. Again, this requires that care is taken when creating additional indexes.

Index structure in SAP HANA

The example below illustrates the direct mapping of dictionary values IDs to table row IDs using an inverted index (shown on the right). 
The column dictionary contains all existing column values in sorted order, but it does not provide any information about which rows of the table contain the individual values. 
The mapping between the dictionary value IDs and the related table row IDs is only available through the inverted index. 
Without the index, the whole column would have to be scanned to find a specific value:




Recomendation when creating indexes in SAP HANA


Recomendation when creating indexes in SAP HANA


  • Avoid non-unique indexes
Columns in a column table are inherently index-like and therefore do not usually benefit from additional indexes. In some scenarios (for example, multiple-column joins or unique constraints), indexes can further improve performance.
Start without any indexes and then add them if needed.

  • Create as few indexes as possible
Every index imposes an overhead in terms of space and performance, so you should create as few indexes as possible.


  • Ensure that the indexes are as small as possible
Specify as few columns as possible in an index so that the space overhead is minimized.


  • Prefer single-column indexes in the column store
Single-column indexes in the column store have a much lower space overhead because they are just light-weight data structures created on top of the column structure. Therefore, you should use single-column indexes whenever possible.
Due to the in-memory approach in SAP HANA environments, it is generally sufficient to define an index on only the most selective column. (In other relational databases, optimal performance can often only be achieved by using a multi-column index.)

2020년 1월 19일 일요일

pcs 업데이트 절차

 pcs 관련 명령어 수행시 'UnicodeDecodeError' 에러 발생























## 참고 사이트
https://access.redhat.com/solutions/3349941































### pcs 업데이트 절차 ( local repository 지정 )

1) rhel-server-7.5-x86_64-dvd.iso 마운트
2) '/media'로 cdrom 마운트
  $ mount -o loop  hel-server-7.5-x86_64-dvd.iso /media
3) '/etc/yum.repos.d/local.repo'의 'baseurl' 속성 확인
baseusrl=file:///media/addons/HighAvailability

4) repository 목록 확인
  $ yum repolist

5) pcs update 수행
  $ yum update pcs

6) pcs 상태 체크
  $ pcs status

2016년 1월 29일 금요일

netstat 명령의 state 필드에 대한 설명

netstat의 State 필드에 표시되는 TCP 상태표시가 갖는 의미를 알아봅시다.
RFC 793 문서에 있는 TCP 기본 연결, 종료 과정을 보면 이해가 더 빠를 거라 생각한다.
 
-----------------------------------------------------------
# netstat -atn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address          Foreign Address       State
... 생략 ...
tcp        0      0 0.0.0.0:25             0.0.0.0:*             LISTEN      <-- 포트가 열렸음
tcp        0      0 192.168.123.10:32799   207.46.106.141:1863   ESTABLISHED <-- 서로 연결중
tcp        0      0 192.168.123.10:32794   218.xxx.xx.xx:22      ESTABLISHED
tcp        0      0 192.168.123.10:32802   207.46.108.46:1863    CLOSE_WAIT  <-- 종료 대기중
tcp        0      0 192.168.123.10:33244   211.xxx.xx.x:80       ESTABLISHED
... 생략 ...
-----------------------------------------------------------
 

1) TCP 연결관련 상태

 
* RFC 793문서에 나온 기본적인 TCP 연결 과정

      TCP A                                                      TCP B

  1.  CLOSED                                                     LISTEN
  2.  SYN-SENT    --> < SEQ=100>< CTL=SYN>                   --> SYN-RECEIVED
  3.  ESTABLISHED <-- < SEQ=300>< ACK=101>< CTL=SYN,ACK>     <-- SYN-RECEIVED
  4.  ESTABLISHED --> < SEQ=101>< ACK=301>< CTL=ACK>         --> ESTABLISHED
  5.  ESTABLISHED --> < SEQ=101>< ACK=301>< CTL=ACK>< DATA>  --> ESTABLISHED

LISTEN      : 데몬이 요청을 발을 수 있도록 연결 요구를 기다리는 상태
  즉, 포트가 열려있음을 의미. http(80), mail(25), ftp(21), telnet(23) 등
  위에서 포트 25(mail)이 메일을 받을 수 있도록 열려 있는 상태
  윈도우즈에서는 LISTENING으로 표시
SYN_SENT    : 로컬에서 원격으로 연결 요청(SYN 신호를 보냄)을 시도한 상태
SYN_RECV    : 원격으로 부터 연결 요청을 받은 상태
  요청을 받아 SYN+ACK 신호로 응답은 한 상태이지만 ACK는 받지 못했다.
  netstat로 확인할 때 SYN_RECV가 상당히 많다면 TCP SYN 플러딩(Flooding) 공격일
  가능성이 있다.
  윈도우즈와 솔라리스에서는 SYN_RECEIVED으로, FreeBSD는 SYN_RCVD으로 표시
ESTABLISHED : 서로 연결이 되어 있는 상태
  위에서 192.168.123.10의 포트 32794과 218.xxx.xx.xx의 포트 22(ssh)이 서로
  연결되어 있는 상태

2) TCP 종료관련 상태


* 정상적인 연결 종료 과정

      TCP A                                                   TCP B

  1.  ESTABLISHED                                             ESTABLISHED
  2.  (Close)
      FIN-WAIT-1  --> < SEQ=100>< ACK=300>< CTL=FIN,ACK>  --> CLOSE-WAIT
  3.  FIN-WAIT-2  <-- < SEQ=300>< ACK=101>< CTL=ACK>      <-- CLOSE-WAIT
  4.                                                         (Close)
      TIME-WAIT   <-- < SEQ=300>< ACK=101>< CTL=FIN,ACK>  <-- LAST-ACK
  5.  TIME-WAIT   --> < SEQ=101>< ACK=301>< CTL=ACK>      --> CLOSED
  6.  (2 MSL)
      CLOSED                                                     

  • FIN_WAIT1   : 소켓이 닫히고 연결이 종료되고 있는 상태. 원격의 응답은 받을 수 있다.
  •   솔라리스에서는 FIN_WAIT_1로 표시
  • FIN_WAIT2   : 로컬이 원격으로 부터 연결 종료 요구를 기다리는 상태
  •   솔라리스에서는 FIN_WAIT_2로 표시
  • CLOSE_WAIT  : 원격의 연결 요청을 받고 연결이 종료되기를 기다리는 상태
  •   원격으로 부터 FIN+ACK 신호를 받고 ACK 신호를 원격에 보냈다.
  • TIME_WAIT   : 연결은 종료되었으나 원격의 수신 보장을 위해 기다리고 있는 상태
  •   이 상태를 특히 자주 보게되는 Apache에서 KeepAlive를 OFF로 해둔 경우,
  •   Tomcat 서버를 쓰는 경우 등
  • LAST_ACK    : 연결은 종료되었고 승인을 기다리는 상태
  • CLOSED      : 완전히 연결이 종료된 상태

※ 위의 FIN_WAIT1, FIN_WAIT2, CLOSE_WAIT 3개 상태는 연결 종료를 위해 서로간에
   신호를 주고받는 과정에 나타나는 상태로 이해하면 된다.
   종료 요청을 한 곳에서는 FIN_WAIT1, FIN_WAIT2, TIME_WAIT 상태가
   종료 요청을 받는 곳에서는 CLOSE_WAIT, LAST_ACK 상태가 표시된다.

3) 기타


CLOSING     : 연결은 종료되었으나 전송도중 데이타가 분실된 상태
UNKNOWN     : 소켓의 상태를 알 수 없음

솔라리스의 netstat 명령에서는 다음 2개의 상태를 더 표시한다.

IDLE        : 소켓이 열렸지만 binding 되지 않은 상태
BOUND       : listen이나 연결을 위한 준비 상태

Disk performance check

##########################################

Disk performance check

##########################################
 
+ 디스크 성능
time dd if=/dev/zero of=dummy bs=8k  count=131072
time dd if=dummy of=/dev/zero bs=8k  count=131072
 
 
+  iostat: 각 Disk에 받는 Load 측정, Disk 입출력, 활용도, Queue 크기, Transaction 율, Service 시간 등.
-c: User Mode, System Mode, I/O를 위한 Waiting, Idle 등에 사용된 시간의 백분율.
-D: 초당 Disk를 Read, Write와 Utilization에 대한 백분율.
-t: 초당 Terminal에서 사용된 Read, Write의 Character 수.
-x: 추가된 모든 Disk들의 상태 표시.
 
# iostat -xtc 3
Service 시간(svc_t): 입출력 요구에 소요된 시간. 다른 요구가 처리중이므로 Queue에서 대기하는 시간도 포함. 30초 평균이 30%이상이면 점검 필요.
 
# iostat -D 3
I/O가 가장 활발할 때 사용. util(Disk 사용도)가 65%이상이면 과부하.

PRCR-1079 : Failed to start resource ora.testdb.db


오라클 ASM 설치 후 DB 인스턴스 구동시
아래와 같은 에러 발생할 경우


[ora_asm@localhost dbs]$ srvctl start database -d testdb
PRCR-1079 : Failed to start resource ora.testdb.db
CRS-2674: Start of 'ora.testdb.db' on 'localhost' failed
[ora_asm@localhost dbs]$ srvctl start database -d testdb
PRCR-1079 : Failed to start resource ora.testdb.db
CRS-2674: Start of 'ora.testdb.db' on 'localhost' failed
[ora_asm@localhost dbs]$ srvctl start database -d testdb
PRCR-1079 : Failed to start resource ora.testdb.db
CRS-2674: Start of 'ora.testdb.db' on 'localhost' failed
[ora_asm@localhost dbs]$ srvctl start database -d testdb
PRCR-1079 : Failed to start resource ora.testdb.db
CRS-2674: Start of 'ora.testdb.db' on 'localhost' failed
 
 
ORACLE 계정의 init.ora 파일의 권한을 아래와 같이 설정해라
 
ORACLE 계정의 $ORACLE_HOME/dbs 디렉토리로 이동한 후
 
root 계정으로접속후
 
chmod 775 inittestdb.ora
 
 
 
ASM 계정에서 DB 인스턴스 구동
 
[ora_asm@localhost dbs]$ srvctl start database -d testdb
[ora_asm@localhost dbs]$ srvctl status database -d testdb
Database is running.
[ora_asm@localhost dbs]$ srvctl start database -d testdb
[ora_asm@localhost dbs]$ srvctl status database -d testdb
Database is running.
 
 
아래 사이트 참고 :