This document discusses query processing and outlines several models including query plan, iterator model, materialization model, and vectorization model which are approaches used to process queries in a database.
The document discusses concurrency control techniques for indexes including locks versus latches, latch modes, latch crabbing/coupling, examples of using latches for DELETE and INSERT operations, and a better latching algorithm.
This document discusses query processing and outlines several models including query plan, iterator model, materialization model, and vectorization model which are approaches used to process queries in a database.
The document discusses concurrency control techniques for indexes including locks versus latches, latch modes, latch crabbing/coupling, examples of using latches for DELETE and INSERT operations, and a better latching algorithm.
Breadth first search is a technique for exploring all neighboring nodes of a graph before moving to nodes farther away. It begins by exploring all nodes connected to the starting node by a single edge, then all nodes that are two edges away, and so on layer by layer until no new nodes can be added. The numbers in the document represent a graph being explored using breadth first search, with nodes being visited in order of their distance from the starting point.
Breadth first search is a technique for exploring all neighboring nodes of a graph before moving to nodes farther away. It begins by exploring all nodes connected to the starting node by a single edge, then all nodes that are two edges away, and so on layer by layer until no new nodes can be added. The numbers in the document represent a graph being explored using breadth first search, with nodes being visited in order of their distance from the starting point.
2. Aggregates
• AVG, MIN, MAX, SUM, COUNT 등
• SELECT 의 Output 리스트에서만 사용 가능
• COUNT, AVG, SUM 은 DISTINCT 를 지원한다.
• SELECT 에 집계되지 않은 값이 있다면 undefined 이다.
3. Group by & Having
• Group by
• Tuple 을 서브셋으로 구성하며 각 서브셋에 대한 집계를 계산
• SELECT 절에서 집계되지 않은 값은 GROUP BY 절에 존재해야함
• Having
• Aggregation 계산을 기반으로 필터링
• GROUP BY 의 WHERE 절과 같다.
SELECT AVG(s.gpa) AS avg_gpa, e.cid
FROM enrolled AS e, student AS s
WHERE e.sid = s.sid -- AND avg_gpa > 3.9
GROUP BY e.cid
HAVING avg_gpa > 3.9 -- after aggregates
4. String Operations
• LIKE
• 문자열 탐색을 위해 사용됨
• String-matching operators
• ‘%’: 부분 문자열(빈 문자열 포함)을 찾는다.
• ‘_’: 문자 하나를 찾는다.
• SUBSTRING: 문자열 추출
• LOWER, UPPER: 대소문자 변환
• CONCAT: 문자열 연결
• SQL 표준에서는 ‘||’ 로 문자열을 연결 가능
DBMSs String Case String Quotes
SQL-92 Sensitive Single Only
Postgres Sensitive Single Only
MySQL Insensitive Single/Double
SQLite Sensitive Single/Double
DB2 Sensitive Single Only
Oracle Sensitive Single Only
SELECT * FROM student AS s WHERE s.login LIKE '%@c_';
6. Window Functions
• 단일 행과 Tuple 셋을 통해 계산을 수행한다.
• Aggregation 과 비슷하지만 결과가 Single tuple 로 그룹핑되지 않는다.
SELECT ... FUNC_NAME(...) OVER (...) FROM tableName;