dbs Flashcards

(31 cards)

1
Q

Referencni integrita

Cizi klic musi byt v referujici a stejne tak i v referencni tabulce klicem (PRIMARY KEY nebo UNIQUE)

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Referencni integrita

U daneho ciziho klice muze byt definovana nejvyse jedna referencni akce obsluhujici udalost DELTE, UPDATE nebo INSERT

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Referencni integrita

referencni akce popisuje dopad na radky f referujici tabulce, pokud by prislusna aktualizacni operace v referencni tabulce zpusobila naruseni referencni integrity

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Referencni integrita

Pokud neni definovana zadne akce, chovani je identicke jako u varianty NO ACTION

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Referencni integrita

Vysledek referencnich akci NO ACTION a RESTRICT muze byt v pripade pouziti vhodne implementovanych triggery rozdilny

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Relacni model

Relacni databaze obsahuje mnozinu relaci, kazda ma sve relacni schema a vlastni data, tedy mnozinu zaznamu

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Relacni model

Zaznamy v relacich menaji definovane vzajemne poradi, relace mohou obsahovat duplicitni zaznamy

A

FALSE

Records in relations (tables) do not have a defined mutual order: This is True. In a relational database, the order in which records are stored does not matter. The model doesn’t consider the order or sequence of rows in a table, and the data can be fetched in any order.
Relations may contain duplicate records: This is False. A proper relational database does not allow duplicate rows in a table, as each row should uniquely represent a relation. This is usually enforced by the use of primary keys, unique identifiers for each record. However, it’s worth noting that this can vary with different SQL implementations, some of which may allow duplicate records if not properly constrained.
So the entire statement is False because the second part is not correct.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Relacni model

Atributy mohou nabyvat pouze a jenom atomickych hodnot, mluvime proto o tzv. prvni normalni forme

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Relacni model

Klic je libovolna mnozina atributu dane relace, ktera ma idenfitikacni schopnost, tj. dokaze unikatne urcit kazdy zaznam dane relace

A

FALSE

it needs to be mininal to be a key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Relacni model

Klic je libovolna mnozina atributu dane relace, ktera ma idenfitikacni schopnost, tj. dokaze unikatne urcit kazdy zaznam dane relace

A

FALSE

it needs to be mininal to be a key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Relacni model

Libovolna relace muze obsahovat i vice klicu, nejvyse vsak jeden jediny nadklic

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Buffer management

Jeden diskovy blok (stranka) se namapuje do jedne stranky v systeme pameti a to i pokud diskovy blok a pametova stranka maji ruzne velikosi

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Buffer management

Sekvenvni pristup k blokum primarniho souboru na tradicnim magnetickem pevnem disku je vyrazne rychlejsi ned pristup nahodny

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Buffer management

U kazde stranky v systemove pameti si (mimo jine) pamatujememe pocet transakci, ktere k dane strance aktualne pristupuji

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Buffer management

Pokud uz danou stranku v systeme pameti nikdo nevyuziva, je vzdy nutne jeji aktualni obsah zapsat na pevny disk

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Buffer management

Pokud uz v bufferu neni volne misto, vhodna stranka k uvolneni se najde napr. pomoci politiky LRU

17
Q

Name the 4 coffman conditions

A

Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait

18
Q

Coffman conditions

Mutual Exclusion

A

At least one resource must be non-sharable, meaning it can only be used by one process at a time. For example:
A printer that can only be used by one process at a time. If a process is printing, other processes must wait for the printer to become available.

19
Q

Coffman conditions

Hold and Wait

A

A process holding at least one resource can request additional resources while still retaining the ones it currently holds. For example:
Process A holds a lock on a file and requests a lock on a database. While waiting for the database lock, Process A retains the lock on the file.

20
Q

Coffman conditions

No Preemption

A

Resources cannot be forcibly taken away from a process; they can only be released voluntarily. For example:
Process A is using a database connection and cannot have that connection forcefully terminated by another process.

21
Q

Coffman conditions

Circular Wait

A

A circular chain of two or more processes exists, where each process is waiting for a resource held by the next process in the chain. For example:
Process A is waiting for a resource held by Process B, which is waiting for a resource held by Process C, and so on, until a process in the chain is waiting for a resource held by Process A.

22
Q

Armstrong’s axioms

name and explain the Armstrong’s axioms

which of these are independent?

A

Trivial
if Y ⊆ X, then X -> Y

Transitivity
if X -> Y and Y -> Z, then X -> Z

Composition
if X -> Y and X -> Z, then X -> YZ

Decomposition
if X -> YZ, then X -> Y and X -> Z

all of them are independent, if we remove one of them -> we violate the completeness
(porusime vlastnosti uplnosti)

23
Q

Definujte pojem nezotavitelny rozvrh.
Co musi rozvrh splnovat, abychom zcela vyloucili kaskadove ruseni transakci?

A

schedule in a database system where the effects of a transaction’s actions cannot be undone or rolled back.

rozvrh musí splňovat tzv. “striktní dvoufázový zamykací protokol” (Strict Two-Phase Locking protocol, Strict 2PL).

24
Q

Výběr vhodných algoritmů pro jednotlivé operace v rámci plánování vyhodnocení SQL dotazů závisí na několika faktorech, informacích a strukturách:

A

SSITHC

Schéma databáze: Informace o struktuře tabulek, sloupcích, klíčích a vazbách mezi nimi jsou důležité pro rozhodování o optimálním plánu vyhodnocení. Například, znalost indexů a statistik o rozložení dat může pomoci vybrat efektivní přístupové metody.

Statistiky: Statistiky o distribuci dat v tabulkách, například histogramy nebo frekvence hodnot, jsou důležité pro odhad nákladů a selekční faktory operací vyhledávání. Na základě těchto informací se vybírají nejefektivnější algoritmy, například použití vhodných indexů.

Dostupné indexy: Informace o existujících indexech v databázi a jejich struktura jsou rozhodující pro plánování operací vyhledávání. Správný výběr indexu může výrazně zlepšit výkon vyhledávání.

Typy operací: Různé operace SQL dotazů (např. JOIN, GROUP BY, ORDER BY) vyžadují různé algoritmy a strategie pro efektivní vyhodnocení. Například použití vhodného algoritmu pro spojování tabulek může ovlivnit celkový výkon dotazu.

Dostupná hardwarová a softwarová konfigurace: Výběr algoritmů může být ovlivněn také dostupnými zdroji, jako je velikost paměti, počet procesorů, dostupný diskový prostor a další faktory hardwarové a softwarové konfigurace.

Cíle optimalizace: Závisí na preferovaných cílech optimalizace, jako je minimalizace času vyhodnocení dotazu, minimalizace nákladů na I/O operace, minimalizace spotřeby paměti atd.

25
4V characteristics of Big Data
Volume: Refers to the large scale of data, typically measured in terabytes, petabytes, or even larger, that exceeds the capacity of traditional data processing systems. Velocity: Represents the high speed at which data is generated, collected, and processed, requiring real-time or near real-time analytics to extract timely insights. Variety: Encompasses the diverse types and formats of data, including structured, semi-structured, and unstructured data from various sources, posing challenges in data integration and analysis. Veracity: Focuses on the quality and reliability of data, ensuring data accuracy, consistency, and trustworthiness in the context of Big Data analytics.
26
the use of a priority queue in N-way External Merge Sort:
Read and Divide: The input dataset is divided into smaller runs that fit into the available system memory. Sort Each Run: Each run is individually sorted. Merge Runs with Priority Queue: During the merge phase, a priority queue is used to select the smallest element from the current front of each run. The selected element is written to the output file, and the corresponding run advances to the next element. Memory Management: System memory holds portions of the runs being merged. Swapping occurs as pages fill or empty to efficiently utilize memory. Final Merge: If needed, the merge process continues recursively until a single sorted output file is obtained.
27
explain BASE
Basically Available: This implies that the system does guarantee availability of the data as per the CAP theorem, but there may be occasional breakdowns; for example, data may be available but not necessarily up-to-date for all users. Soft state: This means the state of the system could change over time, even without input due to eventual consistency or other factors. Eventually consistent: This implies the system will become consistent over time, given that the system doesn't receive input during that time.
28
Explain ACID
Atomicity: This property ensures that a transaction is treated as a single, indivisible operation, which either succeeds completely, or fails completely; for instance, in a banking system, a fund transfer should either transfer the complete amount or none at all. Consistency: This means that a transaction brings the database from one valid state to another, maintaining database invariants; for example, in a school database, the total number of students enrolled should decrease by one when a student drops out. Isolation: This property ensures that concurrent execution of transactions leaves the database in the same state as if the transactions were executed sequentially; for instance, simultaneous withdrawals from a bank account should not result in an incorrect balance. Durability: This guarantees that once a transaction has been committed, it will remain committed even in the case of a system failure; for example, once a purchase is finalized in an online shopping system, the purchase record remains persistent even if the system crashes afterwards.
29
6 NoSQL basic principles
BASE Schema-less Data: NoSQL databases do not require a predefined schema, allowing for the storage of diverse and complex data structures; for instance, MongoDB can store documents in flexible, JSON-like structures. Scalability: NoSQL databases are designed to scale out by distributing data across multiple servers; for example, Cassandra can distribute data across many nodes in a cluster to handle large amounts of data. Speed: NoSQL databases are often optimized for specific data models (key-value, document, column, graph) for quick data access and manipulation; Redis, a key-value store, provides high speed data operations due to its in-memory nature. Flexibility: NoSQL databases can easily accommodate changes in data and queries, often without downtime; CouchDB, a document store, allows changes to data fields without affecting existing data.
30
Explain the normal forms
První normální forma (1NF): Tabulka je v 1NF, pokud každá buňka obsahuje jedinou a jedinečnou hodnotu a záznamy ve sloupci jsou stejného druhu. Druhá normální forma (2NF): Tabulka je v 2NF, pokud je v 1NF a všechny neklíčové atributy jsou plně závislé na primárním klíči. Třetí normální forma (3NF): Tabulka je v 3NF, pokud je v 2NF a neexistuje žádná tranzitivní závislost mezi neklíčovými atributy.
31
what conditions does any chosen pair of database operations appearing in a history has to fulfill, in order to exclude conflicting operations? name the individual variants of these conflicting operations
In order for a pair of database operations in a history to not have conflicting operations, the following conditions must be met: Both operations are performed by different transactions. Operations performed by the same transaction are not considered conflicting as the operations within a single transaction are totally ordered. At least one of the operations is a write operation. If both operations are read operations (read-read), then they do not conflict because neither operation changes the state of the database. Both operations access the same data item. Operations that are accessing different data items cannot conflict because each operation is operating independently of the other. So, for a pair of operations to not be in conflict, they would either need to be executed by the same transaction, or they would both be read operations, or they would be operating on different data items. Conflicting operations come in three variants: Write-Read (WR) Conflict: This occurs when a write operation by one transaction is followed by a read operation by another transaction on the same data item, and the read operation reads the value written by the first transaction. Read-Write (RW) Conflict: This occurs when a read operation by one transaction is followed by a write operation by another transaction on the same data item, and the write operation changes the value that was read by the first transaction. Write-Write (WW) Conflict: This occurs when a write operation by one transaction is followed by a write operation by another transaction on the same data item. The second write operation could overwrite the value written by the first transaction.