Indexes, statistics and execution plans in Protheus
Connects Protheus access with SQL Server execution-plan analysis.
Overview
DBAccess may translate ISAM operations to SQL; direct queries must still respect Protheus physical names, branch and logical deletion. A work-area order does not force the optimizer to use a particular physical index. SQL Server statistics describe distribution and inform cardinality estimates. An actual plan contains execution data because the query ran: capture requires permissions and cost assessment. Compare SQL, parameters, results, estimated/actual rows, reads and duration under equivalent conditions. The Microsoft instructions apply specifically to SQL Server, not generic database maintenance. (Sources: refs. 1–3.)
Commented example
// Diagnostic path: does not run SQL or change indexes.
// 1. Capture SQL/parameters without sensitive data.
// 2. Check physical names, branch and logical deletion.
// 3. Capture plan in an authorized environment; actual plans run the query.
// 4. Compare estimates, actual rows, reads and duration.
// 5. Repeat with equivalent results before proposing changes.Editorial procedure without a measured benchmark or promised performance gain. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Do not issue REBUILD or UPDATE STATISTICS automatically. Decisions depend on database, load, permissions and maintenance impact with DBA assessment.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.