Date: Fri, 27 Aug 2010 13:51:43 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: SQL performance
Content-Type: text/plain; charset=ISO-8859-1
I don't consider 6 minutes to be terribly long with 5 million records,
though it depends on a lot of factors (machine, network, etc.)
I do think the IN statement is a bit slower than equals, or possibly a join
to a two record table with lab_id only (allows it to do a hash). But maybe
one of the SQL gurus can give you better advice.
On Fri, Aug 27, 2010 at 1:37 PM, Bin Zhu <firstname.lastname@example.org> wrote:
> I am querying a table with 5 millions records and 5 fields using the
> following SQL code:
> proc sql;
> create table test as
> select l.id,l.sample_dt
> from temp.lab l
> where =lab_id in ('8888-8','9999-1')
> order by id, sample_dt;
> It takes very long time to run (6 minutes). Is a way to make it run faster?
> Thanks in advance.
> IMPORTANT NOTICE: This e-mail and any attachments may contain confidential
> or sensitive information which is, or may be, legally privileged or
> otherwise protected by law from further disclosure. It is intended only for
> the addressee. If you received this in error or from someone who was not
> authorized to send it to you, please do not distribute, copy or use it or
> any attachments. Please notify the sender immediately by reply e-mail and
> delete this from your system. Thank you for your cooperation.