Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Wednesday, March 21, 2012

New SP vs parameters

I have a table of 25-30 million properties, from which are retrieved
~150 centered on a point, based on the parameters -- coordinates,
property type and date of transaction. There's an SP (also implemented
as a function returning a table) to return the desired records.

This look-up takes the most time in the C# program that calls it, and
should be optimized. It was suggested that instead of having an SP on
the server, each time the program should create an SP that is the same,
however without any parameters -- with the values hard-coded. Then
execute it, and drop it. This way, the execution plan will be
customized for the specific parameters. I tried it and it turns out
the suggested method is noticeably faster, even compared to recompiling
an SP every time. I was wondering if there is a way to get equivalent
performance out of an SP or UDF that has parameters, or is this
approach necessarily going to be less optimized than hard-coded
non-parameters.

Thanks,
JimHi Jim,
Okay.
Does the SP takes a long time to run as stand alone (executing it on
the server without calling from C#)?
Is it too much of a trouble to post the whole code? Can you time the SP
and what is it?
As a quick solution maybe you can modify the SP to save the result into
a table and return some number instead (as success). Then the C# just
access that table and once done drop it at the end. You can have a
recompile option when creating the stored procedure but might worth as
well if you can increase performance by minor fixes.

jim_geissman@.countrywide.com wrote:

Quote:

Originally Posted by

I have a table of 25-30 million properties, from which are retrieved
~150 centered on a point, based on the parameters -- coordinates,
property type and date of transaction. There's an SP (also implemented
as a function returning a table) to return the desired records.
>
This look-up takes the most time in the C# program that calls it, and
should be optimized. It was suggested that instead of having an SP on
the server, each time the program should create an SP that is the same,
however without any parameters -- with the values hard-coded. Then
execute it, and drop it. This way, the execution plan will be
customized for the specific parameters. I tried it and it turns out
the suggested method is noticeably faster, even compared to recompiling
an SP every time. I was wondering if there is a way to get equivalent
performance out of an SP or UDF that has parameters, or is this
approach necessarily going to be less optimized than hard-coded
non-parameters.
>
Thanks,
Jim

|||Your answer is: "it depends."

Instead of re-creating the stored proc, you can use the WITH RECOMPILE
option, which will probably do what you want:

CREATE PROC dbo.foo WITH RECOMPILE AS
select 'hello world';

http://msdn2.microsoft.com/en-us/li...59(SQL.80).aspx
-Dave

jim_geissman@.countrywide.com wrote:

Quote:

Originally Posted by

I have a table of 25-30 million properties, from which are retrieved
~150 centered on a point, based on the parameters -- coordinates,
property type and date of transaction. There's an SP (also implemented
as a function returning a table) to return the desired records.
>
This look-up takes the most time in the C# program that calls it, and
should be optimized. It was suggested that instead of having an SP on
the server, each time the program should create an SP that is the same,
however without any parameters -- with the values hard-coded. Then
execute it, and drop it. This way, the execution plan will be
customized for the specific parameters. I tried it and it turns out
the suggested method is noticeably faster, even compared to recompiling
an SP every time. I was wondering if there is a way to get equivalent
performance out of an SP or UDF that has parameters, or is this
approach necessarily going to be less optimized than hard-coded
non-parameters.
>
Thanks,
Jim

Wednesday, March 7, 2012

New hidden parameters question

I can see (and have read a little about it here) in Report Manager where you can hide parameters. Why isn't this exposed in the
API? Why can't I set them to be hidden in VS?
Did my service pack maybe not install okay.
ThanksIf you clear the prompt string in the Report Designer parameters dialog, the
parameter automatically becomes hidden. See the SP1 readme for more details.
--
Bryan Keller
Developer Documentation
SQL Server Reporting Services
A friendly reminder that this posting is provided "AS IS" with no
warranties, and confers no rights.
"Scott Meddows" <scott_meddows_no_spm@.tsged-removeme.com> wrote in message
news:O92Ik9tWEHA.3476@.tk2msftngp13.phx.gbl...
> I can see (and have read a little about it here) in Report Manager where
you can hide parameters. Why isn't this exposed in the
> API? Why can't I set them to be hidden in VS?
> Did my service pack maybe not install okay.
> Thanks
>|||You have to set the "Prompt User" check box to checked, and the "Prompt
String" textbox to empty.
"vrodkar" <vrodkar@.discussions.microsoft.com> wrote in message
news:BB9DDE10-B40E-4B5F-AF94-E395FE85D593@.microsoft.com...
> I am using stored procedure which needs user_id as a parameter. I am also
using url access methode to pass this user_id parameter. I have applied SP1.
When I make this parameter non-prompting. I get an error that the parameter
is read only and cannot be set. If I make it promptable, it shows as a
parameter and user can then may enter another Id to see other records. How
can I resolve this. My URL looks like this.
> http://d9sql02/reportserver?/reports/report1&rs:Command=Render&user_id=h5
> "Bryan Keller [MSFT]" wrote:
> > If you clear the prompt string in the Report Designer parameters dialog,
the
> > parameter automatically becomes hidden. See the SP1 readme for more
details.
> >
> > --
> > Bryan Keller
> > Developer Documentation
> > SQL Server Reporting Services
> >
> > A friendly reminder that this posting is provided "AS IS" with no
> > warranties, and confers no rights.
> >
> >
> > "Scott Meddows" <scott_meddows_no_spm@.tsged-removeme.com> wrote in
message
> > news:O92Ik9tWEHA.3476@.tk2msftngp13.phx.gbl...
> > > I can see (and have read a little about it here) in Report Manager
where
> > you can hide parameters. Why isn't this exposed in the
> > > API? Why can't I set them to be hidden in VS?
> > >
> > > Did my service pack maybe not install okay.
> > >
> > > Thanks
> > >
> > >
> >
> >
> >|||You can clear the prompt string from the properties page of the report in
Report Manager after the report is published.
--
This posting is provided "AS IS" with no warranties, and confers no rights
"Chrissie" <Chrissie@.discussions.microsoft.com> wrote in message
news:95FCBC69-90BE-44A8-9801-701CBD15BB38@.microsoft.com...
> If I clear the prompt string in the Report Designer, the parameter becomes
> Hidden and read-only. How do I set the parameter in Report Designer to be
> Hidden but not Read-only.
> If I insert a space in the prompt box, the parameter becomes Hidden but
not
> Read-only, but once I close and repopen the project, the prompt box is
> automatically cleared and my parameter is back to being read-only.
> Chrissie
> "Bryan Keller [MSFT]" wrote:
> > If you clear the prompt string in the Report Designer parameters dialog,
the
> > parameter automatically becomes hidden. See the SP1 readme for more
details.
> >
> > --
> > Bryan Keller
> > Developer Documentation
> > SQL Server Reporting Services
> >
> > A friendly reminder that this posting is provided "AS IS" with no
> > warranties, and confers no rights.
> >
> >
> > "Scott Meddows" <scott_meddows_no_spm@.tsged-removeme.com> wrote in
message
> > news:O92Ik9tWEHA.3476@.tk2msftngp13.phx.gbl...
> > > I can see (and have read a little about it here) in Report Manager
where
> > you can hide parameters. Why isn't this exposed in the
> > > API? Why can't I set them to be hidden in VS?
> > >
> > > Did my service pack maybe not install okay.
> > >
> > > Thanks
> > >
> > >
> >
> >
> >|||Obviously. But that is not a very practical suggestion as I will have a fair
number of reports and an even fairer number of parameters to reset every time
after installing at a client.
"Brian Hartman [MSFT]" wrote:
> You can clear the prompt string from the properties page of the report in
> Report Manager after the report is published.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> "Chrissie" <Chrissie@.discussions.microsoft.com> wrote in message
> news:95FCBC69-90BE-44A8-9801-701CBD15BB38@.microsoft.com...
> > If I clear the prompt string in the Report Designer, the parameter becomes
> > Hidden and read-only. How do I set the parameter in Report Designer to be
> > Hidden but not Read-only.
> >
> > If I insert a space in the prompt box, the parameter becomes Hidden but
> not
> > Read-only, but once I close and repopen the project, the prompt box is
> > automatically cleared and my parameter is back to being read-only.
> >
> > Chrissie
> >
> > "Bryan Keller [MSFT]" wrote:
> >
> > > If you clear the prompt string in the Report Designer parameters dialog,
> the
> > > parameter automatically becomes hidden. See the SP1 readme for more
> details.
> > >
> > > --
> > > Bryan Keller
> > > Developer Documentation
> > > SQL Server Reporting Services
> > >
> > > A friendly reminder that this posting is provided "AS IS" with no
> > > warranties, and confers no rights.
> > >
> > >
> > > "Scott Meddows" <scott_meddows_no_spm@.tsged-removeme.com> wrote in
> message
> > > news:O92Ik9tWEHA.3476@.tk2msftngp13.phx.gbl...
> > > > I can see (and have read a little about it here) in Report Manager
> where
> > > you can hide parameters. Why isn't this exposed in the
> > > > API? Why can't I set them to be hidden in VS?
> > > >
> > > > Did my service pack maybe not install okay.
> > > >
> > > > Thanks
> > > >
> > > >
> > >
> > >
> > >
>
>