Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Cardinality Hint

A3006Jul 25 2024

Hi all,

I have a query which has 4 with clause CTE's.

Now I am joining these CTE's but the interesting part is, query works fast in a lower environment and takes time in production.

Just to add more information, stats are gathered on the tables in both the environments, the table structure is also same with the Indexes and PK, and the number of rows are almost similar (maybe 1k rows more in Production)

When trying to enhance the performance I was suggested to use CARDINALITY hint and see if the plan changes and query executes faster. I honestly saw no change as the query keeps running in prod and doesn't yield the result. I wanted to understand the actual usage of this hint and does it even improve performance. As per my readings, it is advised not to use hints in Production.

Please don't mind as I'm not able to share the actual query.

Comments
Post Details
Added on Jul 25 2024
2 comments
494 views