Showing posts with label bookmark. Show all posts
Showing posts with label bookmark. Show all posts

Sunday, March 25, 2012

Bookmarks

Hi,
How I can create an index in a report which are referencing bookmarks in the
report?
I would like to have this format:
[Name / Title of bookmark] [Page Number]
...
[Name / Title of bookmark] [Page Number]
Can I get the page numer with an expression?
ThanksThis is something I asked for in the early days of RS2000,
it was a problem that could only be resolved by using two passes.
Generate the data, save it into a data table adding a row number to
each record. If you know how many rows fit a page you can then generate
the report then construct an index at the end using the row number.
I'm aware this is far from ideal, but I can't think of another way.
The reason it's difficult is that the different rendering methods all
have different ideas about what a page is.
Cheers
Chris
Eric wrote:
> Hi,
> How I can create an index in a report which are referencing bookmarks
> in the report?
> I would like to have this format:
> [Name / Title of bookmark] [Page Number]
> ...
> [Name / Title of bookmark] [Page Number]
>
> Can I get the page numer with an expression?
> Thanks|||Thanks Chris,
But this is not an option because the report isn't based on one dataset or
table, the report format is mixed.
"Chris" wrote:
> This is something I asked for in the early days of RS2000,
> it was a problem that could only be resolved by using two passes.
> Generate the data, save it into a data table adding a row number to
> each record. If you know how many rows fit a page you can then generate
> the report then construct an index at the end using the row number.
> I'm aware this is far from ideal, but I can't think of another way.
> The reason it's difficult is that the different rendering methods all
> have different ideas about what a page is.
> Cheers
> Chris
>
> Eric wrote:
> > Hi,
> >
> > How I can create an index in a report which are referencing bookmarks
> > in the report?
> >
> > I would like to have this format:
> >
> > [Name / Title of bookmark] [Page Number]
> > ...
> > [Name / Title of bookmark] [Page Number]
> >
> >
> > Can I get the page numer with an expression?
> >
> > Thanks
>
> --
>|||Hi Eric,
Based on my research, Chris's suggestion seems to be the only way to do
this. You have to do this with the dataset. Hope you can understand.
You may submit feedback on this via the link below to improve our product.
http://lab.msdn.microsoft.com/productfeedback/default.aspx
Thanks!
Wei Lu
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Wei
Thanks, but how you want to calculate the pagenumber if you havbe different
tables, freetext, charts, etc.
My questions was also about a custom render item.
Because in the SRSS2005 library you have also a class named 'Bookmark' &
'Bookmarks', where all the bookmarks are stored.
It's there no way to access these classes / properties?
Thanks|||Hi Eric,
Thanks for the update.
I don't think you can use the bookmark directly in a report designer.
You can use the class only in your custom rendering extensions for
Reporting Services.
A rendering extension is a component or module of a report server that
transforms report data and layout information into a device-specific
format. SQL Server Reporting Services includes six rendering extensions:
HTML, Excel, CSV or Text, XML, Image, and PDF. You can create additional
rendering extensions to generate reports in other formats.
The Reporting Services Extension Library is a set of classes, interfaces,
and value types that are included in Reporting Services. This library
provides access to system functionality and is designed to be the
foundation on which Microsoft .NET Framework applications can be used to
extend Reporting Services components.
You may find the information in the Reporting Services Extensions section
in SQL Books online.
Wei Lu
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Wei,
Thanks for your answer.
I have read the documentation and I'm aware of the rendering extension and
also the custom render item.
>>I don't think you can use the bookmark directly in a report designer.
I was talking about a custom report item, like a rendering extension but one
level deeper.
http://msdn2.microsoft.com/en-us/library/ms345259(SQL.90).aspx
>>You can use the class only in your custom rendering extensions for
Reporting Services.
And for a custom report item? Or can the item not access all bookmarks,
because the report wasn't yet rendered fully?
Thanks

Thursday, March 22, 2012

Bookmarks

Hi,
How I can create an index in a report which are referencing bookmarks in the
report?
I would like to have this format:
[Name / Title of bookmark] [Page Number]
...
[Name / Title of bookmark] [Page Number]
Can I get the page numer with an expression?
ThanksHi Eric,
Thank you for posting here!
However, I notice you have posted the same question in this newsgroup,
which MVP have already responded. So please check the answer there and if
you need any further assistance on this particular issue, please reply to
me in that thread so I can follow up with you in time. Also, please don't
cross-post the same question in multiple newsgroups in the future so that
our engineers can work on your question efficiently. Your understanding and
cooperation is appreciated.
Thank you and Have a nice day!
Wei Lu
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.

Bookmark, Explain Plan understanding

When I display my execution plan, a node indicates an Index Seek, the object
listed is the name of the nonclustered indexe used, and the Output list has
[Bmk1002]. Normally in the Output list I see a list of columns when ther
e is
a Bookmark involved, but this is confusing to me cause it is an Index Seek
and the Output list is simply [Bmk1002]. Using "set showplan_all on" sho
ws
the same thing. In this instance do I look at the corresponding Bookmark nod
e
to determine which columns are being sought? Why does it give me a Bookmark
when I am having returned an Index Seek? This is a nasty multi-join query so
I am not including the statement or the tables and indexes. Any possible
explanations would be appreciated.
Message posted via http://www.droptable.comWell, it is because you are trying to get the column/s that do not covered
by index and SQL Server is using nonclusterd index to point to datapage to
return the data
Like
select col1, col30 from table where col1=5
col1 has an index and we will see index seek with bookmark because col30
does not have any index in that case
"cbrichards via droptable.com" <u3288@.uwe> wrote in message
news:605b4028efd9b@.uwe...
> When I display my execution plan, a node indicates an Index Seek, the
> object
> listed is the name of the nonclustered indexe used, and the Output list
> has
> [Bmk1002]. Normally in the Output list I see a list of columns when th
ere
> is
> a Bookmark involved, but this is confusing to me cause it is an Index Seek
> and the Output list is simply [Bmk1002]. Using "set showplan_all on" s
hows
> the same thing. In this instance do I look at the corresponding Bookmark
> node
> to determine which columns are being sought? Why does it give me a
> Bookmark
> when I am having returned an Index Seek? This is a nasty multi-join query
> so
> I am not including the statement or the tables and indexes. Any possible
> explanations would be appreciated.
> --
> Message posted via http://www.droptable.com

Bookmark, Explain Plan understanding

When I display my execution plan, a node indicates an Index Seek, the object
listed is the name of the nonclustered indexe used, and the Output list has
[Bmk1002]. Normally in the Output list I see a list of columns when there is
a Bookmark involved, but this is confusing to me cause it is an Index Seek
and the Output list is simply [Bmk1002]. Using "set showplan_all on" shows
the same thing. In this instance do I look at the corresponding Bookmark node
to determine which columns are being sought? Why does it give me a Bookmark
when I am having returned an Index Seek? This is a nasty multi-join query so
I am not including the statement or the tables and indexes. Any possible
explanations would be appreciated.
--
Message posted via http://www.sqlmonster.comWell, it is because you are trying to get the column/s that do not covered
by index and SQL Server is using nonclusterd index to point to datapage to
return the data
Like
select col1, col30 from table where col1=5
col1 has an index and we will see index seek with bookmark because col30
does not have any index in that case
"cbrichards via SQLMonster.com" <u3288@.uwe> wrote in message
news:605b4028efd9b@.uwe...
> When I display my execution plan, a node indicates an Index Seek, the
> object
> listed is the name of the nonclustered indexe used, and the Output list
> has
> [Bmk1002]. Normally in the Output list I see a list of columns when there
> is
> a Bookmark involved, but this is confusing to me cause it is an Index Seek
> and the Output list is simply [Bmk1002]. Using "set showplan_all on" shows
> the same thing. In this instance do I look at the corresponding Bookmark
> node
> to determine which columns are being sought? Why does it give me a
> Bookmark
> when I am having returned an Index Seek? This is a nasty multi-join query
> so
> I am not including the statement or the tables and indexes. Any possible
> explanations would be appreciated.
> --
> Message posted via http://www.sqlmonster.comsql

bookmark row position

We have a SqlCeResult set and would like to bookmark or save a row when iterating through it. There is a method for ReadAbsolute, but no "GoToAbsolute". What is the technique or method call to save the row position?

Thanks,

Bryan

I’m not quite sure I understand your issue. What's wrong with ReadAbsolute? What it does not do what mysterious "GoToAbsolute" does?

You have a row number (simply store it in a variable and you've got a bookmark), then do ReadAbsolute(), access the row. Do another ReadAbsolute() with previous row number (store it in another variable) and you’re back.

Naturally you can’t access more than one row at a time as RS is a cursor, it only “points” to one row at a time. If you need to access two (or more) records at the same time use two RS or store row data in memory by calling ResultSet.GetValues().

|||

two questions then... how do you get the row number of the current position?

also, if you have the row number and other rows are added and deleted, then the saved position is not good, right? that's why i was hoping there was a bookmark.

bryan

Bookmark lookup takes time in SQL server 2000

Hi All
I have an application with SQL Server 2000 SP4 as my RDBMS.
There is a table with around 1200000 records with all the necessary
indexes defined when i execute the query through query analyzer the no
of rows returned are around 300000, execution plan shows a Bookmark
Lookup. But the bookmark lookup taks lot of time?
Also if i remove the particular index it shows me a Table Scan in
Execution Plan.
Can anyone help me explain why Bookmark lookup takes the same time as
Table Scan?
Thanks & Regards
Vishal.I am not sure if I can but perhaps a covering index would be helpful here.
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Vishal" <vishal.bhute@.gmail.com> wrote in message
news:1159864815.076365.227450@.k70g2000cwa.googlegroups.com...
> Hi All
> I have an application with SQL Server 2000 SP4 as my RDBMS.
> There is a table with around 1200000 records with all the necessary
> indexes defined when i execute the query through query analyzer the no
> of rows returned are around 300000, execution plan shows a Bookmark
> Lookup. But the bookmark lookup taks lot of time?
> Also if i remove the particular index it shows me a Table Scan in
> Execution Plan.
> Can anyone help me explain why Bookmark lookup takes the same time as
> Table Scan?
> Thanks & Regards
> Vishal.
>|||Vishal wrote:
> Hi All
> I have an application with SQL Server 2000 SP4 as my RDBMS.
> There is a table with around 1200000 records with all the necessary
> indexes defined when i execute the query through query analyzer the no
> of rows returned are around 300000, execution plan shows a Bookmark
> Lookup. But the bookmark lookup taks lot of time?
> Also if i remove the particular index it shows me a Table Scan in
> Execution Plan.
> Can anyone help me explain why Bookmark lookup takes the same time as
> Table Scan?
> Thanks & Regards
> Vishal.
>
A bookmark lookup occurs when the index that was used to satisfy the
query doesn't contain all of the columns that were requested from a
specific table. Below is a snippet from an earlier response that I
posted to a similar question:
You can look at the execution plan to see what indexes are being used by
your query. I'll try to give an overly simplified explanation:
Suppose I have a table with 7 columns, Col1 thru Col7.
I have an index named Index1 using Col1, Col2, Col3 as a composite key.
Running the following queries (data volumes/optimizer whims may alter
these behaviors):
-- This will do an index seek using Index1
SELECT Col1, Col2
FROM MyTable
WHERE Col1 = 'x'
-- This will do an index SCAN using Index1
SELECT Col1, Col2
FROM MyTable
WHERE Col2 = 'x'
-- This will do an index seek using Index1, with a bookmark lookup to
get Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col1 = 'x'
-- This will do an index SCAN using Index1, with a bookmark lookup to
get Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col2 = 'x'
Does that make sense? Now let's add another index, Index2, to the
table, using Col2, Col4 as a key:
-- This will now do an index seek using Index2
SELECT Col1, Col2
FROM MyTable
WHERE Col2 = 'x'
-- This will do an index seek using Index2, with a bookmark lookup to
get the value of Col1, not Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col2 = 'x'
These are ridiculously simple examples, and when run against real data
volumes, the optimizer may choose a different course of action,
depending on statistics, distribution of values, etc...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Vishal,
to add another point to the mix, you might just want to check if it's
possible to use a covering index.
I mention this as you are referring to queries against one single table and
there is often a huge time saving if you can cover the query.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Thanks Paul
Can u tell me more about covering Indexes'
As in :
What do they mean'
How to define them?
Rgds
Vishal.
Paul Ibison wrote:
> Vishal,
> to add another point to the mix, you might just want to check if it's
> possible to use a covering index.
> I mention this as you are referring to queries against one single table and
> there is often a huge time saving if you can cover the query.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Tracy Thanks for ur info on Bookmark Lookup.
But does anyone have any Idea Why Bookmark Lookup is taking up same
time as a Table Scan does?
The table on which the query executes has about 80 columns defined.
Could this be the reason when I Execute a Select * on such a Table it
takes same time as a Table Scan?
Rgds
Vishal.
Tracy McKibben wrote:
> Vishal wrote:
> > Hi All
> > I have an application with SQL Server 2000 SP4 as my RDBMS.
> > There is a table with around 1200000 records with all the necessary
> > indexes defined when i execute the query through query analyzer the no
> > of rows returned are around 300000, execution plan shows a Bookmark
> > Lookup. But the bookmark lookup taks lot of time?
> > Also if i remove the particular index it shows me a Table Scan in
> > Execution Plan.
> > Can anyone help me explain why Bookmark lookup takes the same time as
> > Table Scan?
> > Thanks & Regards
> > Vishal.
> >
> A bookmark lookup occurs when the index that was used to satisfy the
> query doesn't contain all of the columns that were requested from a
> specific table. Below is a snippet from an earlier response that I
> posted to a similar question:
> You can look at the execution plan to see what indexes are being used by
> your query. I'll try to give an overly simplified explanation:
> Suppose I have a table with 7 columns, Col1 thru Col7.
> I have an index named Index1 using Col1, Col2, Col3 as a composite key.
> Running the following queries (data volumes/optimizer whims may alter
> these behaviors):
> -- This will do an index seek using Index1
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col1 = 'x'
> -- This will do an index SCAN using Index1
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col2 = 'x'
> -- This will do an index seek using Index1, with a bookmark lookup to
> get Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col1 = 'x'
> -- This will do an index SCAN using Index1, with a bookmark lookup to
> get Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col2 = 'x'
> Does that make sense? Now let's add another index, Index2, to the
> table, using Col2, Col4 as a key:
> -- This will now do an index seek using Index2
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col2 = 'x'
> -- This will do an index seek using Index2, with a bookmark lookup to
> get the value of Col1, not Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col2 = 'x'
> These are ridiculously simple examples, and when run against real data
> volumes, the optimizer may choose a different course of action,
> depending on statistics, distribution of values, etc...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Vishal,
here's an article that sums it up nicely:
http://www.informit.com/articles/article.asp?p=27015&seqNum=6&rl=1
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Vishal,
avoiding the * (all columns) and just getting the ones you need might make
it possible to use a covering index (as in other part of this thread).
But to answer your question with a question, why would you assume that
bookmark lookups are always faster than a tablescan? IE there's a logical
read ("set statistics io on" to see) cutoff point after which carrying out
the bookmark lookup will prove more expensive than a tablescan, eg in a
tablescan you'll read each page once while using a bookmark lookup you might
read each page 100 times.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Bookmark lookup takes time in SQL server 2000

Hi All
I have an application with SQL Server 2000 SP4 as my RDBMS.
There is a table with around 1200000 records with all the necessary
indexes defined when i execute the query through query analyzer the no
of rows returned are around 300000, execution plan shows a Bookmark
Lookup. But the bookmark lookup taks lot of time?
Also if i remove the particular index it shows me a Table Scan in
Execution Plan.
Can anyone help me explain why Bookmark lookup takes the same time as
Table Scan?
Thanks & Regards
Vishal.
I am not sure if I can but perhaps a covering index would be helpful here.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Vishal" <vishal.bhute@.gmail.com> wrote in message
news:1159864815.076365.227450@.k70g2000cwa.googlegr oups.com...
> Hi All
> I have an application with SQL Server 2000 SP4 as my RDBMS.
> There is a table with around 1200000 records with all the necessary
> indexes defined when i execute the query through query analyzer the no
> of rows returned are around 300000, execution plan shows a Bookmark
> Lookup. But the bookmark lookup taks lot of time?
> Also if i remove the particular index it shows me a Table Scan in
> Execution Plan.
> Can anyone help me explain why Bookmark lookup takes the same time as
> Table Scan?
> Thanks & Regards
> Vishal.
>
|||Vishal wrote:
> Hi All
> I have an application with SQL Server 2000 SP4 as my RDBMS.
> There is a table with around 1200000 records with all the necessary
> indexes defined when i execute the query through query analyzer the no
> of rows returned are around 300000, execution plan shows a Bookmark
> Lookup. But the bookmark lookup taks lot of time?
> Also if i remove the particular index it shows me a Table Scan in
> Execution Plan.
> Can anyone help me explain why Bookmark lookup takes the same time as
> Table Scan?
> Thanks & Regards
> Vishal.
>
A bookmark lookup occurs when the index that was used to satisfy the
query doesn't contain all of the columns that were requested from a
specific table. Below is a snippet from an earlier response that I
posted to a similar question:
You can look at the execution plan to see what indexes are being used by
your query. I'll try to give an overly simplified explanation:
Suppose I have a table with 7 columns, Col1 thru Col7.
I have an index named Index1 using Col1, Col2, Col3 as a composite key.
Running the following queries (data volumes/optimizer whims may alter
these behaviors):
-- This will do an index seek using Index1
SELECT Col1, Col2
FROM MyTable
WHERE Col1 = 'x'
-- This will do an index SCAN using Index1
SELECT Col1, Col2
FROM MyTable
WHERE Col2 = 'x'
-- This will do an index seek using Index1, with a bookmark lookup to
get Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col1 = 'x'
-- This will do an index SCAN using Index1, with a bookmark lookup to
get Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col2 = 'x'
Does that make sense? Now let's add another index, Index2, to the
table, using Col2, Col4 as a key:
-- This will now do an index seek using Index2
SELECT Col1, Col2
FROM MyTable
WHERE Col2 = 'x'
-- This will do an index seek using Index2, with a bookmark lookup to
get the value of Col1, not Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col2 = 'x'
These are ridiculously simple examples, and when run against real data
volumes, the optimizer may choose a different course of action,
depending on statistics, distribution of values, etc...
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||Vishal,
to add another point to the mix, you might just want to check if it's
possible to use a covering index.
I mention this as you are referring to queries against one single table and
there is often a huge time saving if you can cover the query.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Thanks Paul
Can u tell me more about covering Indexes?
As in :
What do they mean?
How to define them?
Rgds
Vishal.
Paul Ibison wrote:
> Vishal,
> to add another point to the mix, you might just want to check if it's
> possible to use a covering index.
> I mention this as you are referring to queries against one single table and
> there is often a huge time saving if you can cover the query.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Tracy Thanks for ur info on Bookmark Lookup.
But does anyone have any Idea Why Bookmark Lookup is taking up same
time as a Table Scan does?
The table on which the query executes has about 80 columns defined.
Could this be the reason when I Execute a Select * on such a Table it
takes same time as a Table Scan?
Rgds
Vishal.
Tracy McKibben wrote:
> Vishal wrote:
> A bookmark lookup occurs when the index that was used to satisfy the
> query doesn't contain all of the columns that were requested from a
> specific table. Below is a snippet from an earlier response that I
> posted to a similar question:
> You can look at the execution plan to see what indexes are being used by
> your query. I'll try to give an overly simplified explanation:
> Suppose I have a table with 7 columns, Col1 thru Col7.
> I have an index named Index1 using Col1, Col2, Col3 as a composite key.
> Running the following queries (data volumes/optimizer whims may alter
> these behaviors):
> -- This will do an index seek using Index1
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col1 = 'x'
> -- This will do an index SCAN using Index1
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col2 = 'x'
> -- This will do an index seek using Index1, with a bookmark lookup to
> get Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col1 = 'x'
> -- This will do an index SCAN using Index1, with a bookmark lookup to
> get Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col2 = 'x'
> Does that make sense? Now let's add another index, Index2, to the
> table, using Col2, Col4 as a key:
> -- This will now do an index seek using Index2
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col2 = 'x'
> -- This will do an index seek using Index2, with a bookmark lookup to
> get the value of Col1, not Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col2 = 'x'
> These are ridiculously simple examples, and when run against real data
> volumes, the optimizer may choose a different course of action,
> depending on statistics, distribution of values, etc...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
|||Vishal,
here's an article that sums it up nicely:
http://www.informit.com/articles/art...&seqNum=6&rl=1
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Vishal,
avoiding the * (all columns) and just getting the ones you need might make
it possible to use a covering index (as in other part of this thread).
But to answer your question with a question, why would you assume that
bookmark lookups are always faster than a tablescan? IE there's a logical
read ("set statistics io on" to see) cutoff point after which carrying out
the bookmark lookup will prove more expensive than a tablescan, eg in a
tablescan you'll read each page once while using a bookmark lookup you might
read each page 100 times.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Bookmark lookup takes time in SQL server 2000

Hi All
I have an application with SQL Server 2000 SP4 as my RDBMS.
There is a table with around 1200000 records with all the necessary
indexes defined when i execute the query through query analyzer the no
of rows returned are around 300000, execution plan shows a Bookmark
Lookup. But the bookmark lookup taks lot of time?
Also if i remove the particular index it shows me a Table Scan in
Execution Plan.
Can anyone help me explain why Bookmark lookup takes the same time as
Table Scan?
Thanks & Regards
Vishal.I am not sure if I can but perhaps a covering index would be helpful here.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Vishal" <vishal.bhute@.gmail.com> wrote in message
news:1159864815.076365.227450@.k70g2000cwa.googlegroups.com...
> Hi All
> I have an application with SQL Server 2000 SP4 as my RDBMS.
> There is a table with around 1200000 records with all the necessary
> indexes defined when i execute the query through query analyzer the no
> of rows returned are around 300000, execution plan shows a Bookmark
> Lookup. But the bookmark lookup taks lot of time?
> Also if i remove the particular index it shows me a Table Scan in
> Execution Plan.
> Can anyone help me explain why Bookmark lookup takes the same time as
> Table Scan?
> Thanks & Regards
> Vishal.
>|||Vishal wrote:
> Hi All
> I have an application with SQL Server 2000 SP4 as my RDBMS.
> There is a table with around 1200000 records with all the necessary
> indexes defined when i execute the query through query analyzer the no
> of rows returned are around 300000, execution plan shows a Bookmark
> Lookup. But the bookmark lookup taks lot of time?
> Also if i remove the particular index it shows me a Table Scan in
> Execution Plan.
> Can anyone help me explain why Bookmark lookup takes the same time as
> Table Scan?
> Thanks & Regards
> Vishal.
>
A bookmark lookup occurs when the index that was used to satisfy the
query doesn't contain all of the columns that were requested from a
specific table. Below is a snippet from an earlier response that I
posted to a similar question:
You can look at the execution plan to see what indexes are being used by
your query. I'll try to give an overly simplified explanation:
Suppose I have a table with 7 columns, Col1 thru Col7.
I have an index named Index1 using Col1, Col2, Col3 as a composite key.
Running the following queries (data volumes/optimizer whims may alter
these behaviors):
-- This will do an index seek using Index1
SELECT Col1, Col2
FROM MyTable
WHERE Col1 = 'x'
-- This will do an index SCAN using Index1
SELECT Col1, Col2
FROM MyTable
WHERE Col2 = 'x'
-- This will do an index seek using Index1, with a bookmark lookup to
get Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col1 = 'x'
-- This will do an index SCAN using Index1, with a bookmark lookup to
get Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col2 = 'x'
Does that make sense? Now let's add another index, Index2, to the
table, using Col2, Col4 as a key:
-- This will now do an index seek using Index2
SELECT Col1, Col2
FROM MyTable
WHERE Col2 = 'x'
-- This will do an index seek using Index2, with a bookmark lookup to
get the value of Col1, not Col4
SELECT Col1, Col2, Col4
FROM MyTable
WHERE Col2 = 'x'
These are ridiculously simple examples, and when run against real data
volumes, the optimizer may choose a different course of action,
depending on statistics, distribution of values, etc...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Vishal,
to add another point to the mix, you might just want to check if it's
possible to use a covering index.
I mention this as you are referring to queries against one single table and
there is often a huge time saving if you can cover the query.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Thanks Paul
Can u tell me more about covering Indexes'
As in :
What do they mean'
How to define them?
Rgds
Vishal.
Paul Ibison wrote:
> Vishal,
> to add another point to the mix, you might just want to check if it's
> possible to use a covering index.
> I mention this as you are referring to queries against one single table an
d
> there is often a huge time saving if you can cover the query.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Tracy Thanks for ur info on Bookmark Lookup.
But does anyone have any Idea Why Bookmark Lookup is taking up same
time as a Table Scan does?
The table on which the query executes has about 80 columns defined.
Could this be the reason when I Execute a Select * on such a Table it
takes same time as a Table Scan?
Rgds
Vishal.
Tracy McKibben wrote:
> Vishal wrote:
> A bookmark lookup occurs when the index that was used to satisfy the
> query doesn't contain all of the columns that were requested from a
> specific table. Below is a snippet from an earlier response that I
> posted to a similar question:
> You can look at the execution plan to see what indexes are being used by
> your query. I'll try to give an overly simplified explanation:
> Suppose I have a table with 7 columns, Col1 thru Col7.
> I have an index named Index1 using Col1, Col2, Col3 as a composite key.
> Running the following queries (data volumes/optimizer whims may alter
> these behaviors):
> -- This will do an index seek using Index1
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col1 = 'x'
> -- This will do an index SCAN using Index1
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col2 = 'x'
> -- This will do an index seek using Index1, with a bookmark lookup to
> get Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col1 = 'x'
> -- This will do an index SCAN using Index1, with a bookmark lookup to
> get Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col2 = 'x'
> Does that make sense? Now let's add another index, Index2, to the
> table, using Col2, Col4 as a key:
> -- This will now do an index seek using Index2
> SELECT Col1, Col2
> FROM MyTable
> WHERE Col2 = 'x'
> -- This will do an index seek using Index2, with a bookmark lookup to
> get the value of Col1, not Col4
> SELECT Col1, Col2, Col4
> FROM MyTable
> WHERE Col2 = 'x'
> These are ridiculously simple examples, and when run against real data
> volumes, the optimizer may choose a different course of action,
> depending on statistics, distribution of values, etc...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Vishal,
here's an article that sums it up nicely:
http://www.informit.com/articles/ar...5&seqNum=6&rl=1
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Vishal,
avoiding the * (all columns) and just getting the ones you need might make
it possible to use a covering index (as in other part of this thread).
But to answer your question with a question, why would you assume that
bookmark lookups are always faster than a tablescan? IE there's a logical
read ("set statistics io on" to see) cutoff point after which carrying out
the bookmark lookup will prove more expensive than a tablescan, eg in a
tablescan you'll read each page once while using a bookmark lookup you might
read each page 100 times.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Bookmark lookup cost factors (SQL Server 7.0)

Good day to you.
I am working with some large databases with several tables hosting
millions or tens of millions of records. The actual data is being
stored on a SAN, while the database host is a 4 CPU SMP machine. In
this case the SAN is often a bottleneck while the CPUs are idled.
A situation that I am consistently observing is extremely poor choices
for the uses of indexes -- or rather the lack of index use. What I am
constantly finding for these large tables is that highly unique
non-clustered indexes are being ignored, and instead a table scan is
being performed. The execution engine is (wrongly) assuming that the
bookmark lookups will be more costly than simply doing a tablescan.
The end result is that many queries run 10s or 100s of times longer
than they should without explicitly adding index hints to force it to
use the index.
In one example a table with 5,000,000 or so records has a
non-clustered index on a field, and the statistics believe that there
are around 141 records that match the requested specific criteria
(there are really less -- as a sidenote can one increase the number of
steps stored by statistics?). Instead of quickly pulling the presumed
141 index matches and then doing the corresponding bookmark lookups,
it's instead table scanning all 5,000,000 records. Indeed if I look at
the estimated execution plans, it's claiming that the forced use of
the non-clutered index, and hence forced bookmark lookups, will yield
5x the subtree cost. The end results tell the real story, though -
with the index hint it completes instantly, while without the hint it
takes hundreds of times longer.
Is there a server or database setting that governs the estimation of
the cost of bookmark lookups? I do not wish to resort to unnecessary
hardcoded index hints when it's such a basically incorrect assumption
by the query engine that affects the entire system wherever large
tables are accessed. As a sidenote I had previously heard the
statistic that a non-clustered index will only be used if the
estimated set yields less than 2% of the total set, due to the cost of
bookmark lookups, but in this case it isn't using it even when the
estimated set is ~ 0.003%... how is it choosing?
Thanks
Dennis ForbesHi Dennis,
I think that 285996 PRB: Cost of Using Non-Clustered Indexes May Be Incorrect if Data (
http://support.microsoft.com/?id=285996) is something that may be applicable
to your scenario. Unfortunately there are no 'knobs' that tune the cost es
timation for any operators inside SQL Server.
Thanks,
--R
"Dennis Forbes" <dennis_forbes@.hotmail.com> wrote in message news:32811a52.0
403190902.35fd2ef5@.posting.google.com...
Good day to you.
I am working with some large databases with several tables hosting
millions or tens of millions of records. The actual data is being
stored on a SAN, while the database host is a 4 CPU SMP machine. In
this case the SAN is often a bottleneck while the CPUs are idled.
A situation that I am consistently observing is extremely poor choices
for the uses of indexes -- or rather the lack of index use. What I am
constantly finding for these large tables is that highly unique
non-clustered indexes are being ignored, and instead a table scan is
being performed. The execution engine is (wrongly) assuming that the
bookmark lookups will be more costly than simply doing a tablescan.
The end result is that many queries run 10s or 100s of times longer
than they should without explicitly adding index hints to force it to
use the index.
In one example a table with 5,000,000 or so records has a
non-clustered index on a field, and the statistics believe that there
are around 141 records that match the requested specific criteria
(there are really less -- as a sidenote can one increase the number of
steps stored by statistics?). Instead of quickly pulling the presumed
141 index matches and then doing the corresponding bookmark lookups,
it's instead table scanning all 5,000,000 records. Indeed if I look at
the estimated execution plans, it's claiming that the forced use of
the non-clutered index, and hence forced bookmark lookups, will yield
5x the subtree cost. The end results tell the real story, though -
with the index hint it completes instantly, while without the hint it
takes hundreds of times longer.
Is there a server or database setting that governs the estimation of
the cost of bookmark lookups? I do not wish to resort to unnecessary
hardcoded index hints when it's such a basically incorrect assumption
by the query engine that affects the entire system wherever large
tables are accessed. As a sidenote I had previously heard the
statistic that a non-clustered index will only be used if the
estimated set yields less than 2% of the total set, due to the cost of
bookmark lookups, but in this case it isn't using it even when the
estimated set is ~ 0.003%... how is it choosing?
Thanks
Dennis Forbessql

Bookmark lookup (Why)

I can't figure out why i have a bookmark lookup cost on ValidVendorPackages
on the below proc:
Select PriceViewHotelPrice.price as Totalprice, PriceViewHotelPrice.Docid
from price_view PriceViewHotelPrice Inner Join
(
select C1.Priceid as Pid,C1.VendorPackageId from
(
select distinct(HA.PriceId), HA.VendorPackageId from Criteria HA Inner Join
(
select VendorPackageId from ValidVendorPackages
where (Vendor = @.Vendor or @.Vendor = '')
and (Sitecode = @.Sitecode or @.Sitecode = '')
and (PackageType = @.PackageType or @.PackageType = '')
and (RequiredItems = @.RequiredItems or @.RequiredItems = -1)
)HB on HA.VendorPackageId = HB.VendorPackageId
and
(
CriteriaId in
(
select CriteriaID from ValidItemCriteria
where Destination = @.Destination
and LengthOfStay = @.LengthOfStay
and Ages = @.Ages
and ComponentType = 'H'
and (ValidItemType = @.HotelValidItemType_1 or @.HotelValidItemType_1 = '' )
and (ItemValue = @.HotelItemValue_1 or @.HotelItemValue_1 = '' )
)
)
) C1
) HotelCriteriaPriceId on PriceViewHotelPrice.priceid =
HotelCriteriaPriceId.Pid
and PriceViewHotelPrice.keydate between @.KeyDateMin and @.KeyDateMax
and ((PriceViewHotelPrice.price) between @.PriceLow and @.PriceHigh or
@.PriceLow = -1)
and (PriceViewHotelPrice.Volatility between @.VolatilityMin and
@.VolatilityMax or @.VolatilityMin = -1)
and (PriceViewHotelPrice.AvgMinsUpdateInterval between
@.AvgMinsUpdateIntervalMin and @.AvgMinsUpdateIntervalMax or
@.AvgMinsUpdateIntervalMin = -1)
Order by TotalPrice
can anyone see why?
will
On Wed, 15 Dec 2004 11:55:04 -0800, we7313 wrote:

>I can't figure out why i have a bookmark lookup cost on ValidVendorPackages
>on the below proc:
Hi we7313,
Without knowing your table structure, indexes, etc, I can't do anything
but guess. Peruse at your own risk :-)
Looking at this part of the query:
>select distinct(HA.PriceId), HA.VendorPackageId from Criteria HA Inner Join
>(
>select VendorPackageId from ValidVendorPackages
>where (Vendor = @.Vendor or @.Vendor = '')
>and (Sitecode = @.Sitecode or @.Sitecode = '')
>and (PackageType = @.PackageType or @.PackageType = '')
>and (RequiredItems = @.RequiredItems or @.RequiredItems = -1)
>)HB on HA.VendorPackageId = HB.VendorPackageId
>and
>(
>CriteriaId in
>(
>select CriteriaID from ValidItemCriteria
>where Destination = @.Destination
>and LengthOfStay = @.LengthOfStay
>and Ages = @.Ages
>and ComponentType = 'H'
>and (ValidItemType = @.HotelValidItemType_1 or @.HotelValidItemType_1 = '' )
>and (ItemValue = @.HotelItemValue_1 or @.HotelItemValue_1 = '' )
>)
>)
I think that the optimizer has decided to start with reducing the number
of matching rows in Criteria by checking the CriteriaId in (...)
condition. Criteria rows that match are then used in the join against
ValidVendorPackages (note: the derived table is easily transformed in a
simple join; the optimizer will probably execute it as a simple join).
Obviously, you have a nonclustered index on the column VendorPackageId in
ValidVendorPackages. In order to check the other conditions (on Vendor,
Sitecode, PackageType and RequiredItems) as well, SQL Server has to fetch
the complete row. The nonclustered index used to find the VendorPackageId
will also contain the values for the clustered index on this table: they
serve as a pointer to the complete row. SQL Server will now take these
values and use them to navigate the clustered index down to the row that
corresponds to the index entry. This action (using the clustered index
values stored in the nonclustered index to find the row) is called a
bookmark lookup.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)

Bookmark Lookup

Fellow Developers

i have a query that has joins of tables with huge data (more than 2G of records per table). the execution plan shows me the 80% of the execution is on a "Bookmark Lookup" on the biggest table. Does anyone have clue how can I optimize this query? other than using covering indexes...

best regards

Jeries Shahin wrote:

Other than using covering indexes...

Well, if you know the answer already....

Seriously, you need to understand how indexes in SQL Server work (you may already, so here is the short version.) The nonclustered index uses the key of the clustered index rather than keeping a pointer to the physical page. Of course, this is great almost all of the time, but can be a costly operation at times.

Are you using any hints? And what join operators are being used? That is a lot of data (assuming 2G = 2 GB and not 2 grand :) and I would have assumed it would do a hash join, unless this is doing a merge join. Posting the output of showplan_text would be a good place to start:

set showplan_text on
go

select ...
go

set showplan_text off
go

And what version of SQL Server are you on? The new INCLUDE clause on the CREATE INDEX statement could actually be the ticket. It gives you a covering index without the overhead of including data you aren't using for searching on in the B-Tree (only the leaf nodes are affected)

|||

Why don't you want to use a covering index. Thats like saying I want my car to go but I don't want to use gas. If you want performance from a relational DB system you need to use the right indexes.

I agree that the "include" option in SQL 2005 maybe an option.

|||

Using a covering index can be really costly if the index keys are really large, so it might not be a good idea in 2000 or earlier to cover an index. We don't know his usage pattern and that is a lot of data (again assuming that G means GB :) This query might only be executed once a day/week/month. There may be thousands of modifications a minute on the table.

It might even be that a reporting database/warehouse is in order.

|||

I agree but to some extent if the performance isn't what is required, then something has to be done and there are a number of options covering indexing being on of them, redesign being another.

One always has to balance out their performance needs. This gets much more complex when doing DSS stuff on an OLTP system. ideally they should be mutually exclusive.

Bookmark in Code not working.


I have a report in reporting services that has a bookmark value asigned to each row. In the following Page_Load event for the page, I'm getting the following error on the ReportViewer1.JumpToBookmark("6") statement:

"An exception of type 'System.InvalidOperationException' occurred in Microsoft.ReportViewer.WebForms.dll but was not handled in user code

Additional information: Some parameters or credentials have not been specified"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

Dim strReport1 As String = "/ReportDirectory/CurrentWeekSales"

ReportViewer1.ServerReport.ReportServerUrl = New System.Uri(CStr(Session.Item("ReportServer")))
ReportViewer1.ServerReport.ReportPath = strReport1
ReportViewer1.ServerReport.Timeout = 500000

Do While ReportViewer1.ServerReport.IsDrillthroughReport
ReportViewer1.PerformBack()
Loop

Dim RptParameters1 As ReportParameter() = New ReportParameter(0) {}
RptParameters1(0) = New ReportParameter("EBO_EmpKey", CStr(Session.Item("UserKey")))
ReportViewer1.ServerReport.SetParameters(RptParameters1)

ReportViewer1.ServerReport.Refresh()

ReportViewer1.JumpToBookmark("6")

End If
End Sub

What am I missing?

ThanksI too am having a similar problem. I find that JumpToBookmark() simply does not work no matter what I try. Interestingly, setting the 'action' property of a TextBox within the report to jump to the target bookmark seems to work. Unfortunately, I need to be able to do this in code without having to force the user to click on the report.

Is this a known problem, or is there something else on the viewer and/or report that needs to be set?

Thanks,

Ian.

Bookmark Functionality and HTMLFragment

I have a report displayed within a frame. A different frame in the
frameset is posting parameter values to this report display frame.
The bookmarks on the report do not work when displayed within the
frame. The onclick javascript command is not created for the
bookmarks.
I have the following HTML configuration settings:
Format = HTML4.0
Toolbar = False
Parameters = False
HTMLFragment = True
If I set the HTMLFragment = false, the bookmarks work, but my
subreports are not rendered in IE (but the subreports are rendered in
Firefox), instead I get the typical red X indicative of a missing
image.
When I view the report via Report Manager, the bookmarks work
correctly. When I include the toolbar on the report, the bookmarks
work correctly (and I see the bookmark onclick code generated when I
view the source of the report).
Any help appreciated.The bookmarks will not work in fragment mode as the content is expected to
be inserted in another document. You shouldn't need fragment mode for the
frame. As for why the subreports are not showing, I don't understand why
(especially if you say it works in Firefox). Do you mean images? Subreports
are never replaced with a red X.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
"Potter" <drewpotter@.gmail.com> wrote in message
news:1115943049.364352.197320@.g49g2000cwa.googlegroups.com...
>I have a report displayed within a frame. A different frame in the
> frameset is posting parameter values to this report display frame.
> The bookmarks on the report do not work when displayed within the
> frame. The onclick javascript command is not created for the
> bookmarks.
> I have the following HTML configuration settings:
> Format = HTML4.0
> Toolbar = False
> Parameters = False
> HTMLFragment = True
> If I set the HTMLFragment = false, the bookmarks work, but my
> subreports are not rendered in IE (but the subreports are rendered in
> Firefox), instead I get the typical red X indicative of a missing
> image.
> When I view the report via Report Manager, the bookmarks work
> correctly. When I include the toolbar on the report, the bookmarks
> work correctly (and I see the bookmark onclick code generated when I
> view the source of the report).
> Any help appreciated.
>

Bookmark and back button behavior in Report Manager/IE.

Can anyone verify the expected behavior of the browser back button for
me please? Using Report Manager, I have a one-page report with several
bookmarks. When I jump from a link to one of my bookmarks, is the
"back" button in the browser supposed to take me back to the
originating link? It does nothing. (Using Reporting Services SP1 (Dev)
and IE 6.0 SP2 all on XP os).
Then when I export this to Web Archive (mhtml) format, the back button
works fine for while, then randomly stops working after hitting an
unpredictable number of links within this one-page report. However,
using Netscape 7.0, the exported Web Archive file works beautifully.
Ericemrust@.yahoo.com wrote:
> Can anyone verify the expected behavior of the browser back button for
> me please?
Hi Eric,
i got the same behaviour. After an unpredictable number of jumps from report
to bookmarks and back the browser opens sometimes blank report page or does
nothing.
regards
frank|||Thanks for the reply Frank. Does your browser back button work when
viewing the report using Report Manager? (not an exported file, within
a single page report and using bookmarks within that report) In other
words, you jump to a link within a page, then press the back button to
return to the original link on same page?
I thought mine was working, but I cannot be sure and I don't want to
re-install unless I have to.|||emrust@.yahoo.com wrote:
> In other
> words, you jump to a link within a page, then press the back button to
> return to the original link on same page?
Yes that works for me, but:
If i got some hyperlinks in my report and jump to a linked report, the
Back-Button work for while and after
some clicks...the back button stop working
frank|||After a little more testing, the bookmarks work fine if I say
rc:toolbar=false. Any ideas anyone? Do I need to re-install
something to get the back button and bookmarks to work with the toolbar
active?
Eric|||Here is an update on this problem for anyone interested.
I uninstalled and re-installed everything (vs.net and RS 2000) to no
avail.
I installed SP2. Same back-button problems.
So, I opened an incident with Microsoft and they were able to reproduce
the same behavior listed here.
I was told that an official bug report was issued. I am awaiting the
final word.
Eric|||Unfortunately, this bookmark problem has been determined (by Microsoft)
to be a bug. It was present in SP1 (at least for me) and is also still
present in SP2. I wonder if it existed in the original release of RS
2000? It seems to me like a fairly large oversight, and I am a little
surprised no one found it earlier. Guess I'll have to try another
method. I really like the bookmarks since they are so easy to setup and
use. If only the browser back button worked when using the html viewer
and bookmarks, I would be a happy camper.
Eric|||To make the back button work after using a bookmark to hyperlink, the
workaround I discovered is this....
Go directly to the report using a URL with rc:javascript=false. And
rc:toolbar=false works too, if you don't need the toolbar.
Does anyone know if there is a way to turn off javascript within the
report design so I can use report manager to access the report also?
Thanks,
Ericsql

Bookmark

Is it possible to jump to a bookmark on a report other than the one you are
viewing?No. I thought it should be possible and investigated this awhile back and
found out that you could not do this.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Dustin Mammenga PREMIER CSA"
<DustinMammengaPREMIERCSA@.discussions.microsoft.com> wrote in message
news:8C7B0BEF-C813-4193-BF36-A584D8C1C31E@.microsoft.com...
> Is it possible to jump to a bookmark on a report other than the one you
> are
> viewing?