Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which one is effecient

 
Daniel Sagayaraj
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both querys returns the same result set....

all i want to know is ..... which one is effecient when there is volume of the data exceds 1 lac



select
lo.loc_name,
d.dispense_date,
p.patient_id,
p.patient_last_name,
a.prod_name,
s.lot,
s.expiry_date,
d.physician,
d.notes
from
lp_manage_patient as p,
rfx_ent_products as a,
lp_dispense as d,
lp_serial as s,
rfx_ent_locations as lo
where
d.manage_patient_id = p.manage_patient_id
and
d.product_id = a.prod_id
and
d.serial_id = s.serial_number
and
lo.location_id=p.location_id;


----------------------------------------------------------------------

select
lo.loc_name,
d.dispense_date,
p.patient_id,
p.patient_last_name,
a.prod_name,
s.lot,
s.expiry_date,
d.physician,
d.notes
from lp_manage_patient as p
inner join lp_dispense as d on d.manage_patient_id = p.manage_patient_id
inner join rfx_ent_products as a on d.product_id = a.prod_id
inner join lp_serial as s on d.serial_id = s.serial_number
inner join rfx_ent_locations as lo on lo.location_id=p.location_id;
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if your database supports it, try using 'explain' and see which gives the lower cost.
'explain' is as simple as copying the queries as you have them below, but add the word 'explain' at the start.

eg
explain select * from lp_manage_patient
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic