How to check the usage of indexes when the Sybase database is retrieved

Source: Internet
Author: User
Tags sybase sybase database time 0

1. First execute the following statement in SQL Advantage
Set SHOWPLAN on
Go
See if execution is used to the index.
For example: SELECT issuing.book_name,
Issuing.author,
Issuing.publisher,
Issuing.publish_date,
ISSUING.ISBN,
Issuing.branch,
Issuing.price,
Issuing.biblio_no,
Issuing.biblio_code,
Issuing.data_no,
Issuing.summary,
0,
Issuing.order_status,
Issuing.check_status,
Issuing.money_type
From Mark.issuing issuing
WHERE biblio_code= ' ZD200400002 '
return value:
QUERY PLAN for STATEMENT 1 (at line 1).
STEP 1
The type of query is SELECT.
From TABLE
Mark.issuing
Issuing
Nested iteration.
Table Scan. This shows that the index is not used
Forward Scan.
Positioning at start of table.
Using I/O Size 2 Kbytes for data pages.
With LRU Buffer replacement strategy for data pages.
Parse and Compile time 0.
SQL Server CPU time:0 Ms.
Table:issuing Scan count 1, logical reads: (regular=2915 apf=0 total=2915), physical reads: (regular=0 apf=0 total=0), AP F IOs used=0
Total writes for this command:0

Execution Time 1.
SQL Server CPU time:100 Ms. SQL Server elapsed time:63 Ms.
(629 rows affected)
The above results indicate that the search point is not an index entry, which affects the retrieval speed.
If you add an index, the return value should be as follows.
QUERY PLAN for STATEMENT 1 (at line 1).
STEP 1
The type of query is SELECT.
From TABLE
Mark.issuing
Issuing
Nested iteration.
Index:idx_biblio_code
Forward Scan.
Positioning by key.
Keys are:
Biblio_code ASC
Using I/O Size 2 kbytes for index leaf pages.
With LRU Buffer replacement strategy for index leaf pages.
Using I/O Size 2 Kbytes for data pages.
With LRU Buffer replacement strategy for data pages.
(629 rows affected)
With this index, the retrieval speed will be increased.
2. Similar commands have the following
SET STATISTICS IO on
Go
Set STATISTICS TIME on
Go
Check execution time.
Set NOEXEC on
Go
This means that only the query plan is executed and not really queried.

How to check the usage of indexes when the Sybase database is retrieved

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.