Skip to main content

Relational Algebra Expression(DBMS)

Relational Algebra Expression(DBMS)

SQL queries are decomposed into query blocks. One query block contains a single SELECT-FROM-WHERE expression, as well as GROUP BY and HAVING clause (if any). Nested queries are split into separate query blocks.

Example

Consider an example given below −

Select lastname, firstname from employee where salary>(select max(salary) from employee where deptname =CSE ;
C=(select max(salary) from employee where deptname=CSE); // inner block
Select lastname, firstname from employee where salary>c; //outer block


Where C represents the result returned from the inner block.
  • The relation algebra for the inner block is Ģmax(salary) (σdname=CSE(employee))
  • The relation algebra for the outer blocks is Πlastname, firstname(σsalary>c(employee))

The query optimizer would then choose an execution or evaluation plan for each block.

Evaluation of relational algebra expressions

Materialized evaluation − Evaluate one operation at a time. Evaluate the expression in a bottom-up manner and stores intermediate results to temporary files.




Store the result of A ⋈ B in a temporary file.

Store the result of C ⋈ D in a temporary file.

Finally, join the results stored in temporary files.


The overall cost=sum of costs of individual operations + cost of writing intermediate results to disk, cost of writing results to results to temporary files and reading them back is quite high.

Pipelined evaluation − Evaluate several operations simultaneously. Result of one operation is passed to the next operation. Evaluate the expression in a bottom-up manner and don’t store intermediate results to temporary files.



Don’t store the result of A ⋈ B in a temporary file. Instead, the result is passed directly for projection with C and so on.

Comments

Popular posts from this blog

Function Keys Shortcuts

Function Keys Shortcuts (F1 - F12) (Function Keys) F1 It is used to open the help window in almost all programs. Also used to enter BIOS or CMOS Some computers allow you to enter BIOS setup using different keys like F2, F10, Delete, Esc. Pressing Window + F1 will open the Microsoft Windows Help and Support Center. F2 In Microsoft Windows, it is used to rename an icon , file , or folder that the user selects. In Microsoft Excel, the F2 key allows you to edit the selected cell in the Excel sheet. In Microsoft Word, pressing Ctrl+F2 will open the print preview window and Alt+Ctrl+F2 will open the new file or document. In addition, it is also used to enter the CMOS setup. F3 It is mainly used to open a search function for many programs. At the MS-DOS or Windows command line, it gives users the option to repeat the last command entered. In Microsoft Word, if you press Shift + F3 , it allows you to change the selected text from uppercase to lowercase or a capital letter at the beginni...

Computer Fundamentals in Hindi

Computer Fundamentals in Hindi - कंप्यूटर फंडामेंटल्स हिंदी में - कंप्यूटर का परिचय कंप्यूटर शब्द अंग्रेजी के "Compute" शब्द से बना है, जिसका अर्थ है "गणना", करना होता है इसीलिए इसे गणक या संगणक भी कहा जाता है, इसका अबिस्कर Calculation करने के लिए हुआ था, पुराने समय में Computer का use केवल Calculation करने के लिए किया जाता था किन्तु आजकल इसका use डाक्‍यूमेन्‍ट बनाने, E-Mail, Listening And Viewing Audio And Video, Play Games, Database Preparation के साथ-साथ और कई कामों में किया जा रहा है, जैसे बैकों में, शैक्षणिक संस्‍थानों में, कार्यालयों में, घरों में, दुकानों में, Computer का उपयोग बहुतायत रूप से किया जा रहा है। Computer केवल वह करता है जो हम उसे करने का कहते हैं यानि केवल वह उन Command को फॉलो करता है जो पहले से Computer के अंदर डाले गए होते है, उसके अंदर सोचने समझने की क्षमता नहीं होती है, Computer को जो व्यक्ति चलता है उसे यूजर कहते है, और जो व्यक्ति Computer के लिए Program बनता है उसे Programmer  कहा जाता है। कंप्यूटर को ठीक प्रकार से कार्य करने के लिए सॉफ्टव...

Networking Interview Questions and Answers

Networking Interview Questions and Answers 1) What is a Network? Answer: The network is defined as a set of devices connected to each other through a physical transmission medium. For example, a computer network is a group of computers connected to each other to communicate and share information and resources such as hardware, data, and software. In a network, nodes are used to connect two or more networks. 2) What is a Node? Answer: Two or more computers are directly connected by fiber optics or any other cable. A node is a point where a connection is established. It is a network component used to send, receive, and forward electronic information. A device connected to a network is also called a Node. Let us consider that in a network there are 2 computers, 2 printers, and a server connected, then we can say that there are five nodes in the network. 3) What is Network Topology? Answer:  Network topology is a physical layout of the computer network and defines how computers,...