Beyond Relational Model

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There are no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

What are limitations of pure relational databases?

  • limited support for real word data entities

    • limited installed/base types & complex type support (no complex structure: array/lists/queues, no generalisation/specialisation)

  • operations are set & tuple-based

    • only predefined operators & functions for base type

    • mismatch w/ other software/programming lang.(basic SQL lacks computational completeness)

  • no general purpose rule system


2
New cards

What is a collection type array?

  • attributes of type ARRAY allow column to store multi-valued data

    • columns can be defined as 1/multi dimensional arrays

    • arrays can be fixed/variable length

    • breaks relational model (which requires single valued data)

  • a query can access the entire array/individual elements using array indices


<ul><li><p><strong>attributes </strong>of type <strong>ARRAY </strong>allow column to <strong>store multi-valued data</strong></p><ul><li><p>columns can be defined as 1/multi dimensional arrays</p></li><li><p>arrays can be fixed/variable length</p></li><li><p><strong>breaks relational model</strong> (which requires single valued data)</p></li></ul></li><li><p>a query can <strong>access the entire array/individual elements using array indices</strong></p></li></ul><p></p>
3
New cards

What are binary large objects (BLOBs) used for?

  • used to store large values + binary data

    • e.g. image,PDF,large text files

  • e.g. storing image in Postgres

    • link into file system/web

    • binary data type: bytea

    • Postgres Large Objects lo_import() and lo_export() functions can be used to read/write large objects


4
New cards

What is a more efficient way to use images only for visualisation rather than storing it in a database?

  • consider using links to external file system

    • danger of external data being deleted/moved


5
New cards

In inheritance what do child tables inherit?

all the attributes & constraints of its parent table(s)

(may have own attributes)

<p>all the attributes &amp; constraints of its parent table(s) </p><p>(may have own attributes)</p>
6
New cards

How would you query the parent class & child classes?

SELECT * FROM parent_table;

<p><code>SELECT * FROM parent_table;</code></p>
7
New cards

How would you query only the child table?

SELECT * FROM child_table;

<p><code>SELECT * FROM child_table;</code></p>
8
New cards

How would you query only parent table (no child table data)?

SELECT * FROM ONLY parent_table;

<p><code>SELECT * FROM ONLY parent_table;</code></p>
9
New cards

How are user defined functions (UDFs) created in PostgreSQL?

CREATE FUNCTION func_name

10
New cards

Where are user defined function stored?

  • stored as database objects

    • often called server side functions


11
New cards

When are user defined functions useful?

  • if used repeatedly

  • when doing computation close to the data


12
New cards

What are event-condition-action (ECA) rules?

rules/triggers that enable actions to be triggered automatically by certain events in an active database systems


13
New cards

What is the general form of event-condition-action (ECA) rules?

  • when event takes place

    • e.g insert/update/delete value

    • and if optinal condition is met

    • then specfied action is performed


<ul><li><p>when event takes place</p><ul><li><p>e.g insert/update/delete value</p></li><li><p> and if optinal condition is met</p></li><li><p>then specfied action is performed</p></li></ul></li></ul><p></p>
14
New cards

How are rules created in PostgreSQL?

knowt flashcard image
15
New cards

When may the action be performed when executing an ECA rule?

before, after or instead of the initiating event


16
New cards

What is a trigger used for?

inititates a trigger function to be automatically executed whenever a certain type of operation is performed in a database


17
New cards

What are triggers useful for?

  • non-trivial constraints

  • consistency checking/enforcement


18
New cards

What type of procedures are trigger functions?

server side procedures ( can be written in languages such as C or PL/PgSQL or SQL)

19
New cards

How do you create a trigger in PostgreSQL?

CREATE TRIGGER trigger_name

<p><code>CREATE TRIGGER trigger_name</code></p>
20
New cards

What are desirable properties of an ECA rule system?

  • lack of conflicts

    • conflicts possible when more than 1 rule fires

  • guarenteed termination

    • cycles, nesting/recursion

  • confluence

    • when more than 1 rule fires, order may be significant

    • rule confluent if outcome indpendent of order

  • observable determinism

    • results from confluence, otherwise must be ensured