• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

which one is effecient

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic