I have the folowing two tables.
employee_master (
emp_rid int primary key identity,
emp_no char(20) not null,
emp_name varchar(100)
);
salary_payment(
sp_rid int primary key,
sp_emp_rid int COMMENT 'Maping employee_master .emp_rid',
sp_pay_date date COMMENT 'Payment Date',
sp_amount varchar(100)
);
Assume in index is created on the fields salary_payment( sp_emp_rid).
Here I need to get all the salary payment details for particular employee
having emp_rid 10234.
For this I have two ways of writing querries.
Method 1:
select * from employee_master
join salary_payment on emp_rid = sp_emp_rid
where emp_rid = 10234
Method 2:
select * from employee_master
join salary_payment on (emp_rid = 10234 = and emp_rid = sp_emp_rid)
Question:
Will these methods make the difference in performance, if yes, how?
2 1214
you need to use method 1 .
you need to use method 1 .
As I understand,
In first method all the rows in the first table is taken into joining, so all the records of employee_master table has to be joined with salary_payment. Then it does the filtering out of emp_rid to match 10234.
In the second method only one record from employee_master table will be considered and then the join operation is less expensive.
So the second method will be better. I have no solid idea of it.
Correct me if I am wrong.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alex Vinokur |
last post by:
For instance, we need to measure performance
of assignment 'ch1 = ch2' where ch1 and ch2 are of char type.
We need to do that for different optimization levels of the same compiler.
Here is some test program.
Environment
-----------
|
by: Rune |
last post by:
Is it best to use double quotes and let PHP expand variables inside strings,
or is it faster to do the string manipulation yourself manually?
Which is quicker?
1)
$insert = 'To Be';
$sentence = "$insert or not $insert. That is the question.";
or
|
by: roman ziak |
last post by:
I just read couple articles on this group and it keeps amazing me how
the portability is used as strong argument for language cleanliness.
In my opinion, porting the program (so you just take the source code and
recompile) is a myth started 20-30 years ago when world consisted of
UNIX systems. Well, world does not consist of UNIX systems anymore, but
there are 100s of different systems running in cell-phones, DVD players,
game consoles...
|
by: gurpreet |
last post by:
Hi this is gurpreet,
I know this is a very simple question but still I want
to clear some doubts.
What happens when we compile and link a c-program?
I hope aquite a lot of responses to my querry.
BYE! BYE!
|
by: NigelW |
last post by:
This is really a question for the development team.
Are there plans to improve the optimization of C# to MSIL?
I ask this, as inspection with ILDASM of the MSIL code
shows that, even with the optimization switch on, there is
no inlining even of very short methods, common sub-
expressions are evaulated each time used and constants
used in loops are evaluated at each iteration. The
following code, where I hand optimized the source, runs
| |
by: Kunal |
last post by:
Hello,
I need help in removing if ..else conditions inside for loops. I have
used the following method but I am not sure whether it has actually
helped.
Below is an example to illustrate what I have used.
Original code :
c= 0 ;
for (i=0; i<999; i++)
|
by: Markus Grunwald |
last post by:
Hello,
while implementing a simple algorithm for digital filters (IIR filters), I
got very confused about the very bad performance. This is the code,
discussion follows:
/**
<!-------------------------------------------------------------------------->
* The working horse: Filters a signal
*
|
by: getmeidea |
last post by:
I have the following tables,
1> employee_master(emp_id int primary key, emp_name varchar(100));
2> employee_salary_payment(salary_rid int primary key, emp_id int, sal_date date, paid_amt int);
The tables, employee_master and employee_salary_payment have one to many relation.
I need to list the salary payment done for the employee having id = 10. Here I use two different querry to work.
Querry 1:
Select em.emp_id, em.emp_name,...
|
by: kasthurirangan.balaji |
last post by:
Hi,
Below is the code.
#include <fstream>
#include <set>
#include <string>
#include <iterator>
#include <algorithm>
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |