Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hints: Add test cases for table_stats, index_stats and column_status #46

Closed
PhilippSalvisberg opened this issue Jan 17, 2022 · 0 comments · Fixed by #50
Closed

Hints: Add test cases for table_stats, index_stats and column_status #46

PhilippSalvisberg opened this issue Jan 17, 2022 · 0 comments · Fixed by #50
Assignees
Labels
enhancement New feature or request

Comments

@PhilippSalvisberg
Copy link
Collaborator

Jonathan Lewis added this comment on my blog post about regarding Finding Wrong Hints:

A little detail that’s not commonly known – there are some hints that require you to use the table name (even the schema.table) rather than the alias.

One I know of (thanks to an article by Roger MacNicol: http://orasql.org/2019/04/16/correct-syntax-for-the-table_stats-hint/ ) is the table_stats() hint. Two more, I assume, but haven’t tested in detail yet, would be the index_stats() and column_stats() hints.

It makes sense for these hints because if a table appears several times in a query you’d expect the optimizer to insist that the statistics on that table (and its indexes and columns) were consistent for the whole query.

(You can also see in v$sql_hints that they’re statement-level hints, so you couldn’t make them vary for different query blocks – and in fact the hints would be ignored if you included the @query_block part that can be used in so many other hints.)

The following hints are only part of the ALL_HINTS hash set:

  • TABLE_STATS
  • INDEX_STATS
  • COLUMN_STATS

As a result they should be checked only for violations of G-9601: Never use unknown hints only.

The check regarding G-9602/G-9603 is done only for some chosen hints (via checkTabspec call):

However, it would make sense to define some test cases for TABLE_STATS, INDEX_STATS and COLUMN_STATS hints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant