Well, I thought its not to concern wthe query or the database in this instance, I think(may be I am wrong) the issue is the way I go through the loop. (foreach sample and for each snp)
but here it is:
$conn = XXXXX::Database::Conn->new('live'); #its the wrapper build aro +und the actual DBI module to facilitate the ease of fetching the data +. $conn->addConnection(DBI->connect('dbi:Oracle:SNP.world','snp','snp', +{RaiseError =>1 , AutoCommit=>0}),'snp');

My queries
select distinct i.id_ind from dna_plate p,dnaplate_status ps, dna_wel +l w, individual_name i where p.id_dnaplate = w.id_dnaplate and w.id_c +ontent = i.id_ind and p.plate_type = 13 and ps.id_dnaplate = p.id_dna +plate and ps.status = 7 and p.id_study in(6637,7867) and i.name_type += 2 order by i.id_ind select ss.id_snp from well_assay wa, snpassay_snp sas, snp_summary ss where wa.id_assay = sas.id_assay and sas.id_snp = ss.id_snp and wa.id_well in ('W30467', 'W30569', 'W30572') order by 1 select distinct 'C' as proc_status,nvl(o.abbreviation, substr(translat +e(o.orgtitle, ' ', '_'), 1, 15)) || ':' || nvl(inm.name, 'NOEXTNAME') + as suppname,i.id_ind,i.clonename,g.id_snp,wa.id_well as plex,nvl(dp. +id_dnaplate, 0) as id_dnaplate,nvl(upper(rm.maprow), '-') || nvl( tri +m(to_char(rm.mapcol, '09')), '-') as wellrc,nvl(to_char(g.id_dnawell) +, 'UNKNOWN') as id_dnawell,g.genotype,g.confidence,nvl(dp.plate_name, + 'NOPLATENAME') as plate_name from (individual i left outer join indi +vidual_name inm on i.id_ind = inm.id_ind and inm.name_type = 2), (genotype g left outer join ((dna_well dw join dna_plate dp on dw.id_d +naplate = dp.id_dnaplate) join rowcol_map rm on dp.format = rm.format + and dw.id_map = rm.id_map) on g.id_dnawell = dw.id_dnawell), organisation o, well_assay wa where nvl(i.supplier, 0) = o.id_org and i.id_ind = g.id_ind and g.id_assay = wa.id_assay and i.id_ind = ? and g.id_snp = ? and g.disregard = 0 order by 2, 3, 4, 5, 6

In reply to Re^2: How to increase the efficiency of the code wen working with DB? by Anonymous Monk
in thread How to increase the efficiency of the code wen working with DB? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.