Message from discussion
Stored procedures o queries?
Received: by 10.68.5.67 with SMTP id q3mr908408pbq.101.1307926267620;
Sun, 12 Jun 2011 17:51:07 -0700 (PDT)
X-BeenThere: altnet-hispano@googlegroups.com
Received: by 10.68.15.3 with SMTP id t3ls1155446pbc.1.gmail; Sun, 12 Jun 2011
17:51:05 -0700 (PDT)
Received: by 10.68.40.3 with SMTP id t3mr903685pbk.14.1307926265646;
Sun, 12 Jun 2011 17:51:05 -0700 (PDT)
Received: by 10.68.40.3 with SMTP id t3mr903684pbk.14.1307926265611;
Sun, 12 Jun 2011 17:51:05 -0700 (PDT)
Return-Path: <esteban.grinb...@gmail.com>
Received: from mail-pw0-f43.google.com (mail-pw0-f43.google.com [209.85.160.43])
by gmr-mx.google.com with ESMTPS id c10si12269141pbn.1.2011.06.12.17.51.04
(version=TLSv1/SSLv3 cipher=OTHER);
Sun, 12 Jun 2011 17:51:04 -0700 (PDT)
Received-SPF: pass (google.com: domain of esteban.grinb...@gmail.com designates 209.85.160.43 as permitted sender) client-ip=209.85.160.43;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of esteban.grinb...@gmail.com designates 209.85.160.43 as permitted sender) smtp.mail=esteban.grinb...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by pwj4 with SMTP id 4so2720033pwj.16
for <altnet-hispano@googlegroups.com>; Sun, 12 Jun 2011 17:51:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type;
bh=6Xg+KeMQ+Uh8iGD2Km2c4ew89Js+NCfEOSNJcmyV/GA=;
b=OYxijKUF+AvfpyR4/8MbESgqLVjN4baJ/vOv3DcKIGGmdy7pk7brpk0NfP1yn1kGLQ
tXoPt++0E4aulPFzigEKpAwen+1BQbM+pBnSlOl6AayhvjEHZUR8BCZ6OQayTXzAZKIS
LYafs6JZMO9ELi2frzrK2XRaqEItyvmNMN3qo=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
b=a3fiGg8mL4xSHNUs6HxjiAKfG5N+29/TZ7JeTc6MMuWWJSZbxwIE6BI1ic4YUT1RIh
J2bdL/+MfykEFztqkFLpzexzxZZLd4bzfgNdAT7uskIvtlEL4EFURB/LiQ7imJjp7t+u
5NIt4ya+20Piw4HaDHiE1+I7m2k/58jLzBLSI=
MIME-Version: 1.0
Received: by 10.142.192.11 with SMTP id p11mr710567wff.52.1307926263676; Sun,
12 Jun 2011 17:51:03 -0700 (PDT)
Received: by 10.142.52.16 with HTTP; Sun, 12 Jun 2011 17:51:03 -0700 (PDT)
In-Reply-To: <BANLkTim9n-9a54W6BaWn9P3kuijoZfe...@mail.gmail.com>
References: <BANLkTinjDHAR7zS-331hoBNWU40=FmR...@mail.gmail.com>
<BANLkTim92HxmgX3s-z1Q3Sh4734ODu-...@mail.gmail.com>
<BANLkTimASQvycH50Bh6-jT3PAzTg0nK...@mail.gmail.com>
<BANLkTikRGXxxCQ7z-HLxGq6bt3MoL1W...@mail.gmail.com>
<BANLkTi=AS33RGnGDEkQLM4jgEQ+HeBJ...@mail.gmail.com>
<BANLkTik26mBrJQJCP_F-qkZSY_FmhYX...@mail.gmail.com>
<BANLkTi=qc14SPhU83h8SBVQPMS7kuiM...@mail.gmail.com>
<BANLkTikrzxCaWhYU9a6c+AnDce464Oi...@mail.gmail.com>
<BANLkTimqaVC=EakcjYcPD=SnsaLMWXk...@mail.gmail.com>
<BANLkTi=OOJFT1ynSYWKw5pD=wvk_JeM...@mail.gmail.com>
<BANLkTi=xb=xTQZrAHNGexiUVYAhpgQJ...@mail.gmail.com>
<BANLkTin3tp2nEwE0rToMOnRQ3Ku16ET...@mail.gmail.com>
<BANLkTinzP2nTSevg6gcXB4SA9F0+Hyp...@mail.gmail.com>
<BANLkTi=4w0zMCFyJbZFUUu_tjsdLTik...@mail.gmail.com>
<BANLkTi=oATcp=G_0zFx1AhvmV-WhjSA...@mail.gmail.com>
<BANLkTim9n-9a54W6BaWn9P3kuijoZfe...@mail.gmail.com>
Date: Sun, 12 Jun 2011 21:51:03 -0300
Message-ID: <BANLkTin7goERKhz8mqOuZk6vGqbWon3...@mail.gmail.com>
Subject: Re: [altnet-hispano] Stored procedures o queries?
From: Esteban Grinberg <esteban.grinb...@gmail.com>
To: altnet-hispano@googlegroups.com
Content-Type: multipart/alternative; boundary=000e0cd2e01e56bf6704a58d50f3
--000e0cd2e01e56bf6704a58d50f3
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Leyendo la problem=E1tica de Leonardo, veo que las ventajas de los SP me
parece que son mas de lado operativo, que t=E9cnicas.
O sea, si un sistema sufre cambios muy seguido y es muy sensible al uso de
indices y querys muy optimizadas, me parece un desprop=F3sito andar deploya=
ndo
la aplicaci=F3n por cada prueba de tunning de query que se hace.
Pero del lado de performance, en ese escenario no hay diferencias. El SQL
Server guarda el plan de ejecuci=F3n de las consultas pre parametrizadas.
On Sun, Jun 12, 2011 at 6:20 PM, Marcos Mellibovsky <mell...@gmail.com>wrot=
e:
> En algunos RDBMS los sp se guardan compilados, en sql server no. Para mi,
> desde el punto de vista de performance, en sql server un sp es solo un al=
ias
> de un TSQL. El plan de ejecucion se elige para el resultado de la
> compilacion. El resultado de la compilacion es el mismo para el sp que pa=
ra
> el TSQL que tiene adentro el sp. En ambos casos se compila en la primera
> ejecucion.
>
>
> Ing. Marcos Mellibovsky
> ARSoft Consultor=EDa Inform=E1tica
> mell...@arsoft.com.ar
> 0351 155630801
> msn:mellibovskymar...@hotmail.com
>
>
>
> On Sun, Jun 12, 2011 at 4:52 PM, Jos=E9 F. Romaniello <
> jfromanie...@gmail.com> wrote:
>
>> El 12 de junio de 2011 16:26, Leonardo Micheloni <
>> leonardogabrielmichel...@gmail.com> escribi=F3:
>>
>>> Hoy en d=EDa siempre se utilizan SPs y siempre son revisados los planes=
de
>>> ejecuci=F3n y los =EDndices utilizados por una persona (que vamos a lla=
marle
>>> DBA, la D es por el ingl=E9s Devil)
>>> Ese es el esquema actual, es tan celoso el tema de la performance que s=
e
>>> revisan las estad=EDsticas de objetos de sql para detectar "elefantes" =
de
>>> consumo, tambi=E9n se monitorea el consumo de CPU y RAM del sqlserver y=
el
>>> acceso a disco, etc.
>>
>>
>> "Siempre" en esa frase suena a mucho... Tampoco los RDBMS modernos son
>> tan est=FApidos como para especificarles SIEMPRE el plan de ejecuci=F3n.=
.
>>
>> Alguien ha detallado muchos puntos importantes ac=E1<http://stackoverflo=
w.com/questions/59880/are-stored-procedures-more-efficient-in-general-than-=
inline-statements-on-moder/59932#59932>,
>> a continuaci=F3n pego todo el texto;
>>
>> *NOTE* that this is a general look at stored procedures not regulated to
>> a specific DBMS. Some DBMS (and even, different versions of the same DBM=
S!)
>> may operate contrary to this, so you'll want to double-check with your
>> target DBMS before assuming all of this still holds.
>> I've been a Sybase ASE, MySQL, and SQL Server DBA on-and off since for
>> almost a decade (along with application development in C, PHP, PL/SQL,
>> C#.NET, and Ruby). So, I have no particular axe to grind in this (someti=
mes)
>> holy war.
>> The historical performance benefit of stored procs have generally been
>> from the following (in no particular order):
>>
>> - Pre-parsed SQL
>>
>>
>> - Pre-generated query execution plan
>>
>>
>> - Reduced network latency
>>
>>
>> - Potential cache benefits
>>
>> *Pre-parsed SQL* -- similar benefits to compiled vs. interpreted code,
>> except on a very micro level.
>> *Still an advantage?* Not very noticeable at all on the modern CPU, but
>> if you are sending a single SQL statement that is VERY large
>> eleventy-billion times a second, the parsing overhead can add up.
>> *Pre-generated query execution plan*. If you have many JOINs the
>> permutations can grow quite unmanageable (modern optimizers have limits =
and
>> cut-offs for performance reasons). It is not unknown for very complicate=
d
>> SQL to have distinct, measurable (I've seen a complicated query take 10+
>> seconds just to generate a plan, before we tweaked the DBMS) latencies d=
ue
>> to the optimizer trying to figure out the "near best" execution plan. St=
ored
>> procedures will, generally, store this in memory so you can avoid this
>> overhead.
>> *Still an advantage?* Most DBMS' (the latest editions) will cache the
>> query plans for INDIVIDUAL SQL statements, greatly reducing the performa=
nce
>> differential between stored procs and ad hoc SQL. There are some caveats=
and
>> cases in which this isn't the case, so you'll need to test on your targe=
t
>> DBMS.
>> Also, more and more DBMS allow you to provide optimizer path plans
>> (abstract query plans) to significantly reduce optimization time (for bo=
th
>> ad hoc and stored procedure SQL!!).
>> *WARNING* Cached query plans are not a performance panacea. Occasionally
>> the query plan that is generated is sub-optimal. For example, if you sen=
d SELECT
>> * FROM table WHERE id BETWEEN 1 AND 99999999, the DBMS may select a
>> full-table scan instead of an index scan because you're grabbing every r=
ow
>> in the table (so sayeth the statistics). If this is the cached version, =
then
>> you can get poor performance when you later send SELECT * FROM table
>> WHERE id BETWEEN 1 AND 2. The reasoning behind this is outside the scope
>> of this posting, but for further reading see:
>> http://www.microsoft.com/technet/prodtechnol/sql/2005/frcqupln.mspx and
>> http://msdn.microsoft.com/en-us/library/ms181055.aspx and
>> http://www.simple-talk.com/sql/performance/execution-plan-basics/
>> "In summary, they determined that supplying anything other than the comm=
on
>> values when a compile or recompile was performed resulted in the optimiz=
er
>> compiling and caching the query plan for that particular value. Yet, whe=
n
>> that query plan was reused for subsequent executions of the same query f=
or
>> the common values (=91M=92, =91R=92, or =91T=92), it resulted in sub-opt=
imal
>> performance. This sub-optimal performance problem existed until the quer=
y
>> was recompiled. At that point, based on the @P1 parameter value supplied=
,
>> the query might or might not have a performance problem."
>> *Reduced network latency* A) If you are running the same SQL over and
>> over -- and the SQL adds up to many KB of code -- replacing that with a
>> simple "exec foobar" can really add up. B) Stored procs can be used to m=
ove
>> procedural code into the DBMS. This saves shuffling large amounts of dat=
a
>> off to the client only to have it send a trickle of info back (or none a=
t
>> all!). Analogous to doing a JOIN in the DBMS vs. in your code (everyone'=
s
>> favorite WTF!)
>> *Still an advantage?* A) Modern 1Gb (and 10Gb and up!) Ethernet really
>> make this negligible. B) Depends on how saturated your network is -- why
>> shove several megabytes of data back and forth for no good reason?
>> *Potential cache benefits* Performing server-side transforms of data can
>> potentially be faster if you have sufficient memory on the DBMS and the =
data
>> you need is in memory of the server.
>> *Still an advantage?* Unless your app has shared memory access to DBMS
>> data, the edge will always be to stored procs.
>> Of course, no discussion of Stored Procedure optimization would be
>> complete without a discussion of parameterized and ad hoc SQL.
>> *Parameterized / Prepared SQL
>> *Kind of a cross between stored procedures and ad hoc SQL, they are
>> embedded SQL statements in a host language that uses "parameters" for qu=
ery
>> values, e.g.:
>> SELECT .. FROM yourtable WHERE foo =3D ? AND bar =3D ?
>> These provide a more generalized version of a query that modern-day
>> optimizers can use to cache (and re-use) the query execution plan, resul=
ting
>> in much of the performance benefit of stored procedures.
>> *Ad Hoc SQL* Just open a console window to your DBMS and type in a SQL
>> statement. In the past, these were the "worst" performers (on average) s=
ince
>> the DBMS had no way of pre-optimizing the queries as in the
>> parameterized/stored proc method.
>> *Still a disadvantage?* Not necessarily. Most DBMS have the ability to
>> "abstract" ad hoc SQL into parameterized versions -- thus more or less
>> negating the difference between the two. Some do this implicitly or must=
be
>> enabled with a command setting (SQL server:
>> http://msdn.microsoft.com/en-us/library/ms175037.aspx , Oracle:
>> http://www.praetoriate.com/oracle_tips_cursor_sharing.htm).
>> *Lessons learned?* Moore's law continues to march on and DBMS optimizers=
,
>> with every release, get more sophisticated. Sure, you can place every si=
ngle
>> silly teeny SQL statement inside a stored proc, but just know that the
>> programmers working on optimizers are very smart and are continually loo=
king
>> for ways to improve performance. Eventually (if it's not here already) a=
d
>> hoc SQL performance will become indistinguishable (on average!) from sto=
red
>> procedure performance, so any sort of *massive* stored procedure use **
>> solely for "performance reasons"** sure sounds like premature optimizati=
on
>> to me.
>> Anyway, I think if you avoid the edge cases and have fairly vanilla SQL,
>> you won't notice a difference between ad hoc and stored procedures.
>>
>> --
>> Has recibido este mensaje porque est=E1s suscrito al grupo "AltNet-Hispa=
no"
>> de Grupos de Google.
>> Para publicar una entrada en este grupo, env=EDa un correo electr=F3nico=
a
>> altnet-hispano@googlegroups.com.
>> Para anular tu suscripci=F3n a este grupo, env=EDa un correo electr=F3ni=
co a
>> altnet-hispano+unsubscribe@googlegroups.com
>> Para tener acceso a m=E1s opciones, visita el grupo en
>> http://groups.google.com/group/altnet-hispano?hl=3Des.
>>
>
> --
> Has recibido este mensaje porque est=E1s suscrito al grupo "AltNet-Hispan=
o"
> de Grupos de Google.
> Para publicar una entrada en este grupo, env=EDa un correo electr=F3nico =
a
> altnet-hispano@googlegroups.com.
> Para anular tu suscripci=F3n a este grupo, env=EDa un correo electr=F3nic=
o a
> altnet-hispano+unsubscribe@googlegroups.com
> Para tener acceso a m=E1s opciones, visita el grupo en
> http://groups.google.com/group/altnet-hispano?hl=3Des.
>
--000e0cd2e01e56bf6704a58d50f3
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Leyendo la=A0problem=E1tica=A0de Leonardo, veo que las ventajas de los SP m=
e parece que son mas de lado operativo, que=A0t=E9cnicas.<div>O sea, si un =
sistema sufre cambios muy seguido y es muy sensible al uso de indices y que=
rys muy optimizadas, me parece un=A0desprop=F3sito=A0andar deployando la=A0=
aplicaci=F3n=A0por cada prueba de tunning de query que se hace.=A0</div>
<div>Pero del lado de performance, en ese escenario no hay diferencias. El =
SQL Server guarda el plan de=A0ejecuci=F3n=A0de las consultas pre parametri=
zadas.<br><br><div class=3D"gmail_quote">On Sun, Jun 12, 2011 at 6:20 PM, M=
arcos Mellibovsky <span dir=3D"ltr"><<a href=3D"mailto:mell...@gmail.com=
">mell...@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;">En algunos RDBMS los sp se guardan compilad=
os, en sql server no. Para mi, desde el punto de vista de performance, en s=
ql server un sp es solo un alias de un TSQL. El plan de ejecucion se elige =
para el resultado de la compilacion. El resultado de la compilacion es el m=
ismo para el sp que para el TSQL que tiene adentro el sp. En ambos casos se=
compila en la primera ejecucion. =A0<div>
<br></div><div><br></div><div><div><div class=3D"im">Ing. Marcos Mellibovsk=
y<br>ARSoft Consultor=EDa Inform=E1tica<br><a href=3D"mailto:mellibo@arsoft=
.com.ar" target=3D"_blank">mell...@arsoft.com.ar</a><br>0351 155630801<br><=
a href=3D"mailto:msn%3Amellibovskymar...@hotmail.com" target=3D"_blank">msn=
:mellibovskymar...@hotmail.com</a><br>
<br>
<br><br></div><div><div></div><div class=3D"h5"><div class=3D"gmail_quote">=
On Sun, Jun 12, 2011 at 4:52 PM, Jos=E9 F. Romaniello <span dir=3D"ltr"><=
;<a href=3D"mailto:jfromanie...@gmail.com" target=3D"_blank">jfromaniello@g=
mail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
<div>El 12 de junio de 2011 16:26, Leonardo Micheloni=A0<span dir=3D"ltr">&=
lt;<a href=3D"mailto:leonardogabrielmichel...@gmail.com" target=3D"_blank">=
leonardogabrielmichel...@gmail.com</a>></span>=A0escribi=F3:=A0</div><di=
v>
<blockquote class=3D"gmail_quote" style=3D"margin-top:0px;margin-right:0px;=
margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color=
:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
Hoy en d=EDa siempre se utilizan SPs y siempre son revisados los planes de =
ejecuci=F3n y los =EDndices utilizados por una persona (que vamos a llamarl=
e DBA, la D es por el ingl=E9s Devil)<br>Ese es el esquema actual, es tan c=
eloso el tema de la performance que se revisan las estad=EDsticas de objeto=
s de sql para detectar "elefantes" de consumo, tambi=E9n se monit=
orea el consumo de CPU y RAM del sqlserver y el acceso a disco, etc.</block=
quote>
<div><br></div></div><div>"Siempre" en esa frase suena a mucho...=
=A0Tampoco los RDBMS modernos son tan=A0est=FApidos=A0como para especificar=
les SIEMPRE el plan de ejecuci=F3n..</div><div><br></div><div>Alguien ha de=
tallado <a href=3D"http://stackoverflow.com/questions/59880/are-stored-proc=
edures-more-efficient-in-general-than-inline-statements-on-moder/59932#5993=
2" target=3D"_blank">muchos puntos importantes=A0ac=E1</a>, a continuaci=F3=
n pego todo el texto;</div>
<blockquote><strong style=3D"margin-top:0px;margin-right:0px;margin-bottom:=
0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;pa=
dding-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-wi=
dth:0px;border-left-width:0px;border-style:initial;border-color:initial;fon=
t-size:14px;vertical-align:baseline;background-color:transparent;font-weigh=
t:bold;background-repeat:initial initial">NOTE</strong>=A0that this is a ge=
neral look at stored procedures not regulated to a specific DBMS. Some DBMS=
(and even, different versions of the same DBMS!) may operate contrary to t=
his, so you'll want to double-check with your target DBMS before assumi=
ng all of this still holds.<br>
I've been a Sybase ASE, MySQL, and SQL Server DBA on-and off since for =
almost a decade (along with application development in C, PHP, PL/SQL, C#.N=
ET, and Ruby). So, I have no particular axe to grind in this (sometimes) ho=
ly war.<br>
The historical performance benefit of stored procs have generally been from=
the following (in no particular order):<ul style=3D"margin-top:0px;margin-=
right:0px;margin-bottom:1em;margin-left:30px;padding-top:0px;padding-right:=
0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-w=
idth:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial=
;border-color:initial;font-size:14px;vertical-align:baseline;background-col=
or:transparent;list-style-type:disc;list-style-position:initial;background-=
repeat:initial initial">
<li style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;background-repeat:initial =
initial">
Pre-parsed SQL</li></ul><ul style=3D"margin-top:0px;margin-right:0px;margin=
-bottom:1em;margin-left:30px;padding-top:0px;padding-right:0px;padding-bott=
om:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;border-=
bottom-width:0px;border-left-width:0px;border-style:initial;border-color:in=
itial;font-size:14px;vertical-align:baseline;background-color:transparent;l=
ist-style-type:disc;list-style-position:initial;background-repeat:initial i=
nitial">
<li style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;background-repeat:initial =
initial">
Pre-generated query execution plan</li></ul><ul style=3D"margin-top:0px;mar=
gin-right:0px;margin-bottom:1em;margin-left:30px;padding-top:0px;padding-ri=
ght:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-rig=
ht-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:ini=
tial;border-color:initial;font-size:14px;vertical-align:baseline;background=
-color:transparent;list-style-type:disc;list-style-position:initial;backgro=
und-repeat:initial initial">
<li style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;background-repeat:initial =
initial">
Reduced network latency</li></ul><ul style=3D"margin-top:0px;margin-right:0=
px;margin-bottom:1em;margin-left:30px;padding-top:0px;padding-right:0px;pad=
ding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0p=
x;border-bottom-width:0px;border-left-width:0px;border-style:initial;border=
-color:initial;font-size:14px;vertical-align:baseline;background-color:tran=
sparent;list-style-type:disc;list-style-position:initial;background-repeat:=
initial initial">
<li style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;background-repeat:initial =
initial">
Potential cache benefits</li></ul><strong style=3D"margin-top:0px;margin-ri=
ght:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px=
;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-widt=
h:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;bo=
rder-color:initial;font-size:14px;vertical-align:baseline;background-color:=
transparent;font-weight:bold;background-repeat:initial initial">Pre-parsed =
SQL</strong>=A0-- similar benefits to compiled vs. interpreted code, except=
on a very micro level.<br>
<em style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;font-style:italic;backgrou=
nd-repeat:initial initial">Still an advantage?</em>=A0Not very noticeable a=
t all on the modern CPU, but if you are sending a single SQL statement that=
is VERY large eleventy-billion times a second, the parsing overhead can ad=
d up.<br>
<strong style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-l=
eft:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0=
px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;bord=
er-left-width:0px;border-style:initial;border-color:initial;font-size:14px;=
vertical-align:baseline;background-color:transparent;font-weight:bold;backg=
round-repeat:initial initial">Pre-generated query execution plan</strong>. =
If you have many JOINs the permutations can grow quite unmanageable (modern=
optimizers have limits and cut-offs for performance reasons). It is not un=
known for very complicated SQL to have distinct, measurable (I've seen =
a complicated query take 10+ seconds just to generate a plan, before we twe=
aked the DBMS) latencies due to the optimizer trying to figure out the &quo=
t;near best" execution plan. Stored procedures will, generally, store =
this in memory so you can avoid this overhead.<br>
<em style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;font-style:italic;backgrou=
nd-repeat:initial initial">Still an advantage?</em>=A0Most DBMS' (the l=
atest editions) will cache the query plans for INDIVIDUAL SQL statements, g=
reatly reducing the performance differential between stored procs and ad ho=
c SQL. There are some caveats and cases in which this isn't the case, s=
o you'll need to test on your target DBMS.<br>
Also, more and more DBMS allow you to provide optimizer path plans (abstrac=
t query plans) to significantly reduce optimization time (for both ad hoc a=
nd stored procedure SQL!!).<br><strong style=3D"margin-top:0px;margin-right=
:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;pa=
dding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0=
px;border-bottom-width:0px;border-left-width:0px;border-style:initial;borde=
r-color:initial;font-size:14px;vertical-align:baseline;background-color:tra=
nsparent;font-weight:bold;background-repeat:initial initial">WARNING</stron=
g>=A0Cached query plans are not a performance panacea. Occasionally the que=
ry plan that is generated is sub-optimal. For example, if you send=A0<code =
style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;=
padding-top:1px;padding-right:5px;padding-bottom:1px;padding-left:5px;borde=
r-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-=
width:0px;border-style:initial;border-color:initial;font-size:14px;vertical=
-align:baseline;background-color:rgb(238, 238, 238);font-family:Consolas, M=
enlo, Monaco, 'Lucida Console', 'Liberation Mono', 'Dej=
aVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New=
9;, monospace, serif;background-repeat:initial initial">SELECT * FROM table=
WHERE id BETWEEN 1 AND 99999999</code>, the DBMS may select a full-table s=
can instead of an index scan because you're grabbing every row in the t=
able (so sayeth the statistics). If this is the cached version, then you ca=
n get poor performance when you later send=A0<code style=3D"margin-top:0px;=
margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:1px;padding-=
right:5px;padding-bottom:1px;padding-left:5px;border-top-width:0px;border-r=
ight-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:i=
nitial;border-color:initial;font-size:14px;vertical-align:baseline;backgrou=
nd-color:rgb(238, 238, 238);font-family:Consolas, Menlo, Monaco, 'Lucid=
a Console', 'Liberation Mono', 'DejaVu Sans Mono', '=
;Bitstream Vera Sans Mono', 'Courier New', monospace, serif;bac=
kground-repeat:initial initial">SELECT * FROM table WHERE id BETWEEN 1 AND =
2</code>. The reasoning behind this is outside the scope of this posting, b=
ut for further reading see:<a href=3D"http://www.microsoft.com/technet/prod=
technol/sql/2005/frcqupln.mspx" rel=3D"nofollow" style=3D"margin-top:0px;ma=
rgin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-ri=
ght:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-rig=
ht-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:ini=
tial;border-color:initial;font-size:14px;vertical-align:baseline;background=
-color:transparent;color:rgb(0, 119, 204);text-decoration:none;background-r=
epeat:initial initial" target=3D"_blank">http://www.microsoft.com/technet/p=
rodtechnol/sql/2005/frcqupln.mspx</a>=A0and<a href=3D"http://msdn.microsoft=
.com/en-us/library/ms181055.aspx" rel=3D"nofollow" style=3D"margin-top:0px;=
margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-=
right:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-r=
ight-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:i=
nitial;border-color:initial;font-size:14px;vertical-align:baseline;backgrou=
nd-color:transparent;color:rgb(0, 119, 204);text-decoration:none;background=
-repeat:initial initial" target=3D"_blank">http://msdn.microsoft.com/en-us/=
library/ms181055.aspx</a>=A0and=A0<a href=3D"http://www.simple-talk.com/sql=
/performance/execution-plan-basics/" rel=3D"nofollow" style=3D"margin-top:0=
px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;paddi=
ng-right:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;borde=
r-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-styl=
e:initial;border-color:initial;font-size:14px;vertical-align:baseline;backg=
round-color:transparent;color:rgb(0, 119, 204);text-decoration:none;backgro=
und-repeat:initial initial" target=3D"_blank">http://www.simple-talk.com/sq=
l/performance/execution-plan-basics/<br>
</a>"In summary, they determined that supplying anything other than th=
e common values when a compile or recompile was performed resulted in the o=
ptimizer compiling and caching the query plan for that particular value. Ye=
t, when that query plan was reused for subsequent executions of the same qu=
ery for the common values (=91M=92, =91R=92, or =91T=92), it resulted in su=
b-optimal performance. This sub-optimal performance problem existed until t=
he query was recompiled. At that point, based on the @P1 parameter value su=
pplied, the query might or might not have a performance problem."<br>
<strong style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-l=
eft:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0=
px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;bord=
er-left-width:0px;border-style:initial;border-color:initial;font-size:14px;=
vertical-align:baseline;background-color:transparent;font-weight:bold;backg=
round-repeat:initial initial">Reduced network latency</strong>=A0A) If you =
are running the same SQL over and over -- and the SQL adds up to many KB of=
code -- replacing that with a simple "exec foobar" can really ad=
d up. B) Stored procs can be used to move procedural code into the DBMS. Th=
is saves shuffling large amounts of data off to the client only to have it =
send a trickle of info back (or none at all!). Analogous to doing a JOIN in=
the DBMS vs. in your code (everyone's favorite WTF!)<br>
<em style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;font-style:italic;backgrou=
nd-repeat:initial initial">Still an advantage?</em>=A0A) Modern 1Gb (and 10=
Gb and up!) Ethernet really make this negligible. B) Depends on how saturat=
ed your network is -- why shove several megabytes of data back and forth fo=
r no good reason?<br>
<strong style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-l=
eft:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0=
px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;bord=
er-left-width:0px;border-style:initial;border-color:initial;font-size:14px;=
vertical-align:baseline;background-color:transparent;font-weight:bold;backg=
round-repeat:initial initial">Potential cache benefits</strong>=A0Performin=
g server-side transforms of data can potentially be faster if you have suff=
icient memory on the DBMS and the data you need is in memory of the server.=
<br>
<em style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;font-style:italic;backgrou=
nd-repeat:initial initial">Still an advantage?</em>=A0Unless your app has s=
hared memory access to DBMS data, the edge will always be to stored procs.<=
br>
Of course, no discussion of Stored Procedure optimization would be complete=
without a discussion of parameterized and ad hoc SQL.<br><strong style=3D"=
margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-t=
op:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-wid=
th:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px=
;border-style:initial;border-color:initial;font-size:14px;vertical-align:ba=
seline;background-color:transparent;font-weight:bold;background-repeat:init=
ial initial">Parameterized / Prepared SQL<br>
</strong>Kind of a cross between stored procedures and ad hoc SQL, they are=
embedded SQL statements in a host language that uses "parameters"=
; for query values, e.g.:<br><code style=3D"margin-top:0px;margin-right:0px=
;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;paddin=
g-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;b=
order-bottom-width:0px;border-left-width:0px;border-style:initial;border-co=
lor:initial;font-size:14px;vertical-align:baseline;background-color:rgb(238=
, 238, 238);font-family:Consolas, Menlo, Monaco, 'Lucida Console', =
'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera =
Sans Mono', 'Courier New', monospace, serif;background-repeat:i=
nitial initial"><span style=3D"margin-top:0px;margin-right:0px;margin-botto=
m:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;=
padding-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-=
width:0px;border-left-width:0px;border-style:initial;border-color:initial;f=
ont-size:14px;vertical-align:baseline;background-color:transparent;color:rg=
b(0, 0, 139);background-repeat:initial initial">SELECT</span><span style=3D=
"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-=
top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-wi=
dth:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0p=
x;border-style:initial;border-color:initial;font-size:14px;vertical-align:b=
aseline;background-color:transparent;color:rgb(0, 0, 0);background-repeat:i=
nitial initial"> </span><span style=3D"margin-top:0px;margin-right:0px;marg=
in-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bot=
tom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;border=
-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:i=
nitial;font-size:14px;vertical-align:baseline;background-color:transparent;=
color:rgb(0, 0, 0);background-repeat:initial initial">..</span><span style=
=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;paddi=
ng-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top=
-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width=
:0px;border-style:initial;border-color:initial;font-size:14px;vertical-alig=
n:baseline;background-color:transparent;color:rgb(0, 0, 0);background-repea=
t:initial initial"> </span><span style=3D"margin-top:0px;margin-right:0px;m=
argin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-=
bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;bor=
der-bottom-width:0px;border-left-width:0px;border-style:initial;border-colo=
r:initial;font-size:14px;vertical-align:baseline;background-color:transpare=
nt;color:rgb(0, 0, 139);background-repeat:initial initial">FROM</span><span=
style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px=
;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;bord=
er-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left=
-width:0px;border-style:initial;border-color:initial;font-size:14px;vertica=
l-align:baseline;background-color:transparent;color:rgb(0, 0, 0);background=
-repeat:initial initial"> yourtable </span><span style=3D"margin-top:0px;ma=
rgin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-ri=
ght:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-rig=
ht-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:ini=
tial;border-color:initial;font-size:14px;vertical-align:baseline;background=
-color:transparent;color:rgb(0, 0, 139);background-repeat:initial initial">=
WHERE</span><span style=3D"margin-top:0px;margin-right:0px;margin-bottom:0p=
x;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padd=
ing-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-widt=
h:0px;border-left-width:0px;border-style:initial;border-color:initial;font-=
size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,=
0, 0);background-repeat:initial initial"> foo </span><span style=3D"margin=
-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px=
;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px=
;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;borde=
r-style:initial;border-color:initial;font-size:14px;vertical-align:baseline=
;background-color:transparent;color:rgb(0, 0, 0);background-repeat:initial =
initial">=3D</span><span style=3D"margin-top:0px;margin-right:0px;margin-bo=
ttom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0=
px;padding-left:0px;border-top-width:0px;border-right-width:0px;border-bott=
om-width:0px;border-left-width:0px;border-style:initial;border-color:initia=
l;font-size:14px;vertical-align:baseline;background-color:transparent;color=
:rgb(0, 0, 0);background-repeat:initial initial"> </span><span style=3D"mar=
gin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:=
0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-width:=
0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;bo=
rder-style:initial;border-color:initial;font-size:14px;vertical-align:basel=
ine;background-color:transparent;color:rgb(0, 0, 0);background-repeat:initi=
al initial">?</span><span style=3D"margin-top:0px;margin-right:0px;margin-b=
ottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:=
0px;padding-left:0px;border-top-width:0px;border-right-width:0px;border-bot=
tom-width:0px;border-left-width:0px;border-style:initial;border-color:initi=
al;font-size:14px;vertical-align:baseline;background-color:transparent;colo=
r:rgb(0, 0, 0);background-repeat:initial initial"> </span><span style=3D"ma=
rgin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top=
:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-width=
:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;b=
order-style:initial;border-color:initial;font-size:14px;vertical-align:base=
line;background-color:transparent;color:rgb(0, 0, 139);background-repeat:in=
itial initial">AND</span><span style=3D"margin-top:0px;margin-right:0px;mar=
gin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bo=
ttom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;borde=
r-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:=
initial;font-size:14px;vertical-align:baseline;background-color:transparent=
;color:rgb(0, 0, 0);background-repeat:initial initial"> bar </span><span st=
yle=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;pa=
dding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-=
top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-wi=
dth:0px;border-style:initial;border-color:initial;font-size:14px;vertical-a=
lign:baseline;background-color:transparent;color:rgb(0, 0, 0);background-re=
peat:initial initial">=3D</span><span style=3D"margin-top:0px;margin-right:=
0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;pad=
ding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0p=
x;border-bottom-width:0px;border-left-width:0px;border-style:initial;border=
-color:initial;font-size:14px;vertical-align:baseline;background-color:tran=
sparent;color:rgb(0, 0, 0);background-repeat:initial initial"> </span><span=
style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px=
;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;bord=
er-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left=
-width:0px;border-style:initial;border-color:initial;font-size:14px;vertica=
l-align:baseline;background-color:transparent;color:rgb(0, 0, 0);background=
-repeat:initial initial">?<br>
</span></code>These provide a more generalized version of a query that mode=
rn-day optimizers can use to cache (and re-use) the query execution plan, r=
esulting in much of the performance benefit of stored procedures.<br><stron=
g style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0p=
x;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;bor=
der-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-lef=
t-width:0px;border-style:initial;border-color:initial;font-size:14px;vertic=
al-align:baseline;background-color:transparent;font-weight:bold;background-=
repeat:initial initial">Ad Hoc SQL</strong>=A0Just open a console window to=
your DBMS and type in a SQL statement. In the past, these were the "w=
orst" performers (on average) since the DBMS had no way of pre-optimiz=
ing the queries as in the parameterized/stored proc method.<br>
<em style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:=
0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;b=
order-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-l=
eft-width:0px;border-style:initial;border-color:initial;font-size:14px;vert=
ical-align:baseline;background-color:transparent;font-style:italic;backgrou=
nd-repeat:initial initial">Still a disadvantage?</em>=A0Not necessarily. Mo=
st DBMS have the ability to "abstract" ad hoc SQL into parameteri=
zed versions -- thus more or less negating the difference between the two. =
Some do this implicitly or must be enabled with a command setting (SQL serv=
er:=A0<a href=3D"http://msdn.microsoft.com/en-us/library/ms175037.aspx" rel=
=3D"nofollow" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;ma=
rgin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-=
left:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0p=
x;border-left-width:0px;border-style:initial;border-color:initial;font-size=
:14px;vertical-align:baseline;background-color:transparent;color:rgb(0, 119=
, 204);text-decoration:none;background-repeat:initial initial" target=3D"_b=
lank">http://msdn.microsoft.com/en-us/library/ms175037.aspx</a>=A0, Oracle:=
=A0<a href=3D"http://www.praetoriate.com/oracle_tips_cursor_sharing.htm" re=
l=3D"nofollow" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;m=
argin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding=
-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0=
px;border-left-width:0px;border-style:initial;border-color:initial;font-siz=
e:14px;vertical-align:baseline;background-color:transparent;color:rgb(0, 11=
9, 204);text-decoration:none;background-repeat:initial initial" target=3D"_=
blank">http://www.praetoriate.com/oracle_tips_cursor_sharing.htm</a>).<br>
<strong style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-l=
eft:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0=
px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;bord=
er-left-width:0px;border-style:initial;border-color:initial;font-size:14px;=
vertical-align:baseline;background-color:transparent;font-weight:bold;backg=
round-repeat:initial initial">Lessons learned?</strong>=A0Moore's law c=
ontinues to march on and DBMS optimizers, with every release, get more soph=
isticated. Sure, you can place every single silly teeny SQL statement insid=
e a stored proc, but just know that the programmers working on optimizers a=
re very smart and are continually looking for ways to improve performance. =
Eventually (if it's not here already) ad hoc SQL performance will becom=
e indistinguishable (on average!) from stored procedure performance, so any=
sort of=A0<em style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;m=
argin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding=
-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0=
px;border-left-width:0px;border-style:initial;border-color:initial;font-siz=
e:14px;vertical-align:baseline;background-color:transparent;font-style:ital=
ic;background-repeat:initial initial">massive</em>=A0stored procedure use *=
* solely for "performance reasons"** sure sounds like premature o=
ptimization to me.<br>
Anyway, I think if you avoid the edge cases and have fairly vanilla SQL, yo=
u won't notice a difference between ad hoc and stored procedures.</bloc=
kquote><div><div></div><div>
<p></p>
-- <br>
Has recibido este mensaje porque est=E1s suscrito al grupo "AltNet-His=
pano" de Grupos de Google.<br>
Para publicar una entrada en este grupo, env=EDa un correo electr=F3nico a =
<a href=3D"mailto:altnet-hispano@googlegroups.com" target=3D"_blank">altnet=
-hispano@googlegroups.com</a>.<br>
Para anular tu suscripci=F3n a este grupo, env=EDa un correo electr=F3nico =
a <a href=3D"mailto:altnet-hispano%2Bunsubscribe@googlegroups.com" target=
=3D"_blank">altnet-hispano+unsubscribe@googlegroups.com</a><br>
Para tener acceso a m=E1s opciones, visita el grupo en <a href=3D"http://gr=
oups.google.com/group/altnet-hispano?hl=3Des" target=3D"_blank">http://grou=
ps.google.com/group/altnet-hispano?hl=3Des</a>.<br>
</div></div></blockquote></div><br></div></div></div></div><div><div></div>=
<div class=3D"h5">
<p></p>
-- <br>
Has recibido este mensaje porque est=E1s suscrito al grupo "AltNet-His=
pano" de Grupos de Google.<br>
Para publicar una entrada en este grupo, env=EDa un correo electr=F3nico a =
<a href=3D"mailto:altnet-hispano@googlegroups.com" target=3D"_blank">altnet=
-hispano@googlegroups.com</a>.<br>
Para anular tu suscripci=F3n a este grupo, env=EDa un correo electr=F3nico =
a <a href=3D"mailto:altnet-hispano%2Bunsubscribe@googlegroups.com" target=
=3D"_blank">altnet-hispano+unsubscribe@googlegroups.com</a><br>
Para tener acceso a m=E1s opciones, visita el grupo en <a href=3D"http://gr=
oups.google.com/group/altnet-hispano?hl=3Des" target=3D"_blank">http://grou=
ps.google.com/group/altnet-hispano?hl=3Des</a>.<br>
</div></div></blockquote></div><br></div>
--000e0cd2e01e56bf6704a58d50f3--