Précédent   Forum des professionnels en informatique > Bases de données > Oracle > SQL
SQL Forum d'entraide sur le SQL pour Oracle
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 08/05/2008, 10h10   #1
Membre du Club
 
Avatar de Arvulis
 
Inscription : septembre 2003
Messages : 115
Détails du profil
Informations personnelles :
Âge : 30
Localisation : France

Informations forums :
Inscription : septembre 2003
Messages : 115
Points : 45
Points : 45
Envoyer un message via AIM à Arvulis
Par défaut Tuning Advisor : Erreur avec l'utilisation de Order by

Bonjour à tous,

je suis en 10.2.0.3 sur du solaris 64bits et en faisant du tuning sur une requete, j'obtiens ceci :

Code :
1
2
3
4
5
6
7
 
- The optimizer could NOT merge the VIEW at line ID 6 of the execution plan.
  The optimizer cannot merge a VIEW that contains an "ORDER BY" clause unless
  the statement IS a "DELETE" OR an "UPDATE" AND the parent query IS the top
  most query IN the statement.
- The optimizer could NOT merge the VIEW at line ID 4 of the execution plan.
  The optimizer cannot merge a VIEW that contains "ROWNUM" pseudo COLUMN
Avec une requete du style :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SELECT numberofnewsbydomain (10, 'france', '1,2,3,4,5,6,7,8,9,11') AS ID, 
       NULL AS title, NULL AS summary, NULL AS published_on, 0 AS weight, 
       0 AS id_language, NULL AS code_language, 0 AS id_provider, 
       NULL AS code_provider, NULL AS updated_on 
  FROM DUAL 
UNION --ALL 
SELECT selectednews.ID AS ID, nn1.title AS title, nn1.summary AS summary, 
       nn1.published_on AS published_on, nn1.weight AS weight, 
       nn1.id_language AS id_language, 
       (SELECT ll.code 
          FROM mm_language ll 
         WHERE ll.ID = nn1.id_language) AS code_language, 
       nn1.id_provider AS id_provider, 
       (SELECT pp.code 
          FROM mm_newsprovider pp 
         WHERE pp.ID = nn1.id_provider) AS code_provider, 
       nn1.updated_on AS updated_on 
  FROM mm_newsitem nn1 
       JOIN 
       (SELECT a.* 
          FROM (SELECT /*+ FIRST_ROWS +*/ 
                       ROWNUM rnum, a.* 
                  FROM (SELECT   /*+ INDEX_COMBINE(NN) */ 
                                 nn.ID AS ID 
                            FROM mm_newsitem nn 
                           WHERE contains (nn.text_concat, '(usa)') > 0 
                             AND nn.id_provider IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 11) 
                        ORDER BY nn.published_on DESC) a 
                 WHERE ROWNUM <= 1124) a 
         WHERE rnum >= 15 OR rnum <= 4) selectednews ON selectednews.ID = nn1.ID;

Quelqu'un aurais t'il un avis ?
Arvulis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/05/2008, 17h35   #2
Expert Confirmé Sénior
 
Avatar de mnitu
 
Homme Marius Nitu
Ingénieur développement logiciels
Inscription : octobre 2007
Messages : 3 320
Détails du profil
Informations personnelles :
Nom : Homme Marius Nitu
Localisation : France, Marne (Champagne Ardenne)

Informations professionnelles :
Activité : Ingénieur développement logiciels
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : octobre 2007
Messages : 3 320
Points : 5 839
Points : 5 839
Bref, il dit qui lui est impossible de faire le "view merging" à cause de la clause Order By or due à l’utilisation de la pseudo colonne RowNum
Citation:
13.4.1.1.1 View Merging
Each view referenced in a query is expanded by the parser into a separate query block. The query block essentially represents the view definition, and therefore the result of a view. One option for the optimizer is to analyze the view query block separately and generate a view subplan. The optimizer then processes the rest of the query by using the view subplan in the generation of an overall query plan. This technique usually leads to a suboptimal query plan, because the view is optimized separately from rest of the query.

The query transformer then removes the potentially suboptimal plan by merging the view query block into the query block that contains the view. Most types of views are merged. When a view is merged, the query block representing the view is merged into the containing query block. Generating a subplan is no longer necessary, because the view query block is eliminated.

mnitu est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 15h47.


 
 
 
 
Partenaires

Hébergement Web