How do I tune a SQL statement that uses a Nested Loops join instead of a Hash Join?

Поділитися
Вставка
  • Опубліковано 18 лис 2024

КОМЕНТАРІ • 22

  • @Manojp1989
    @Manojp1989 Рік тому +1

    Excellent use on extended statistics

  • @oraclecore4702
    @oraclecore4702 2 роки тому +2

    Hi Maria, ur explanation is extraordinary. I am learning Performance tuning from sites and tutorials, but everyone explaining with simple examples. You are giving valuable information. I wish to post more videos on PT.

  • @sjwood0
    @sjwood0 Рік тому +1

    I love this Maria, you've made what can be a complex subject so easy to understand!

  • @ravitejabattini9766
    @ravitejabattini9766 2 роки тому +1

    Very very useful video and it is helping my daily dba routines. Thanks Maria

  • @natxuz
    @natxuz 2 роки тому

    Hi and Tx! for your explanation, it's more easiest understand the internal functionality of a query

  • @alanhowlett6096
    @alanhowlett6096 2 роки тому +1

    Love it! Helpful, useful, effective, and entertaining!

  • @trichymahesh1
    @trichymahesh1 2 роки тому +1

    Great info with excellent explanation as always.

  • @fernandozani5674
    @fernandozani5674 2 роки тому +2

    Hi! Great content. I have a question: what exactly is the point of changing the join method if the cost of the new plan is 9x more expensive?

    • @SQLMaria
      @SQLMaria  2 роки тому +2

      The original plan is slower and its cost is artificially low because the cardinality estimates are incorrect. By fixing the cardinality estimates the cost of both plans changes and the HASH Join plan which was 9X more expensive now becomes the cheaper of the two plans and provides better performance (shorter elapse time).

  • @sa2sa22
    @sa2sa22 Рік тому

    Hello Maria, Great content as always. I have a question: at 2:44 I still dont get it why the optimizer could not use the actual rows of 10K when he was able to calculate 1% of the 10K to calculate the cardinality estimate ;-)

  • @bt2gr8k72
    @bt2gr8k72 2 роки тому

    Absolutely loved it.

  • @richsoule
    @richsoule 2 роки тому

    At 4:01 the closing parenthesis on the 2nd statement is an open paren instead of a close paren.

    • @SQLMaria
      @SQLMaria  2 роки тому

      The second statement is actually the heading of the statement output that is truncated automatically by Oracle.

  • @ViviCraft-rg5it
    @ViviCraft-rg5it 2 роки тому

    Thank you very much for all your work!
    Is it a good practice to use a Bitmap type index for a column like cust_id? I assume that this column is like the primary key of the Customers table, so it will contain lots of disparate values (unique ones).

    • @SQLMaria
      @SQLMaria  2 роки тому +1

      Hi Vivi, Honestly, no it's not a good practice to use a bitmap index on a column like the cust_id column, which has a lot of distinct values. A bitmap index is typically most effective on a column with a low number of distinct values.

    • @ViviCraft-rg5it
      @ViviCraft-rg5it 2 роки тому

      @@SQLMaria Thank you

  • @urvxfvdzrnp
    @urvxfvdzrnp 2 роки тому +1

    Great

  • @ozandurlu
    @ozandurlu 2 роки тому +1

    Your avatar so cute :)

  • @Helloimtheshiieet
    @Helloimtheshiieet Рік тому

    First off the first SQL statement is literally terrible. 1) never use a WHERE clause to define joins order of operations WHERE is after join, in million row dataset you can exclude directly BEFORE it hits WHERE clause. This is literally horrific examples. NEVER use functions on indexes. Just use the indexes without functions. This person should be taken off UA-cam. Please find other Creators. Holy god.

    • @SQLMaria
      @SQLMaria  Рік тому

      Hi Trevor, thanks for your comment, but I fear you missed the point of the video.
      The purpose of the video is to indicate how to tune a SQL statement rather than how to write the best SQL statement. Also, I suspect your knowledge of how the sophisticated Oracle Optimizer works is sadly lacking. Regardless of where you specify a join condition within a SQL statement, the Oracle Optimizer will first find the most efficient access methods to retrieve the data, applying the where clause predicates as either access or filter predicates and then join the data sets.