[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/15/2008 at 09:04AM PDT, ID: 23732416
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

tune the query ( distinct )

Asked by vishali_vishu in Oracle 9.x, Oracle Database, Oracle 10.x

Tags: oracle

i created a bitmap index on event_25 and an b-tree index on order_no_10 and the query is executing for 2.5 mins.....

if i remove the distinct ......it is running in seconds....

what should i do ?
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:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
SELECT DISTINCT g1.state_5 state, g1.order_no_10 asr_no, g1.ccna_22 ccna,
                g1.provisioning_center_9 prov_center, g1.pon_12 pon,
                g1.related_order_13 rord, g1.version_11 ver,
                g1.product_14 product, g1.svc_type_sc_18 sc,
                DECODE (g1.activity_15,
                        'N', 'New',
                        'D', 'Disco',
                        'C', 'Change'
                       ) activity,
                g1.st_16 st, g1.crdd_jep_32 crdd_jep, g1.ead_jep_33 ead_jep,
                (CASE
                    WHEN ead_jep_33 LIKE 'H37%'
                       THEN DECODE (ead_jep_33,
                                    'H37A', 'Internal AT&T Initiated (Pre-ASR)',
                                    'H37B', 'Internal AT&T Initiated (Post-ASR)',
                                    'H37C', 'Customer Initiated (Pre-ASR)',
                                    'H37D', 'Customer Initiated (Post-ASR)',
                                    'H37E', 'Provisioning',
                                    'H37F', 'Provisioning',
                                    'H37G', 'Provisioning',
                                    'H37H', 'Provisioning',
                                    'H37I', 'Cancelled (Pre-ASR)',
                                    'H37J', 'Cancelled (Post-ASR)',
                                    'H37K', 'Internal on EFMS Escal',
                                    'H37M', 'Provisioning',
                                    'H37P', 'Database Discrepancy',
                                    'H37R', 'Internal on EFMS Escal',
                                    'H37S', 'Customer Initiated (EFMS)',
                                    'H37T', 'Escalations for FOC EAD or DLR (EFMS)',
                                    'H37X', 'Provisioning',
                                    'H37Z', 'Provisioning'
                                   )
                    WHEN crdd_jep_32 LIKE 'H37%'
                       THEN DECODE (crdd_jep_32,
                                    'H37A', 'Internal AT&T Initiated (Pre-ASR)',
                                    'H37B', 'Internal AT&T Initiated (Post-ASR)',
                                    'H37C', 'Customer Initiated (Pre-ASR)',
                                    'H37D', 'Customer Initiated (Post-ASR)',
                                    'H37E', 'Provisioning',
                                    'H37F', 'Provisioning',
                                    'H37G', 'Provisioning',
                                    'H37H', 'Provisioning',
                                    'H37I', 'Cancelled (Pre-ASR)',
                                    'H37J', 'Cancelled (Post-ASR)',
                                    'H37K', 'Internal on EFMS Escal',
                                    'H37M', 'Provisioning',
                                    'H37P', 'Database Discrepancy',
                                    'H37R', 'Internal on EFMS Escal',
                                    'H37S', 'Customer Initiated (EFMS)',
                                    'H37T', 'Escalations for FOC EAD or DLR (EFMS)',
                                    'H37X', 'Provisioning',
                                    'H37Z', 'Provisioning'
                                   )
                    ELSE 'NEO Escalation'
                 END
                ) expedite_desc,
                TO_CHAR (g1.order_due_date_38, 'MM/DD/YYYY') dd_due,
                TO_CHAR (g1.order_create_date_24, 'MM/DD/YYYY') create_date,
                g1.dd_jep_34 dd_jep, g1.jmc_jep_35 jmc_jep, g1.city_4 city,
                g1.area_mgr_3 om, g1.region_1 region,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'XCDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) xcdd_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'XCDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) xcdd_comp,
                (SELECT jep_code_28
                   FROM gnfo_report_asr
                  WHERE order_no_10 = g1.order_no_10
                    AND event_25 = 'XCDD'
                    AND ROWNUM = 1) xcdd_jep,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'EDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) edd_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'EDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) edd_comp,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'INSC'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) insc_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'INSC'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) insc_comp,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'HXDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) hxdd_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'HXDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) hxdd_comp,
                (SELECT jep_code_28
                   FROM gnfo_report_asr
                  WHERE order_no_10 = g1.order_no_10
                    AND event_25 = 'HXDD'
                    AND ROWNUM = 1) hxdd_jep,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'LCDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) lcdd_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'LCDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) lcdd_comp,
                (SELECT jep_code_28
                   FROM gnfo_report_asr
                  WHERE order_no_10 = g1.order_no_10
                    AND event_25 = 'LCDD'
                    AND ROWNUM = 1) lcdd_jep,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'LABL'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) labl_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'LABL'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) labl_comp,
                (SELECT jep_code_28
                   FROM gnfo_report_asr
                  WHERE order_no_10 = g1.order_no_10
                    AND event_25 = 'LABL'
                    AND ROWNUM = 1) labl_jep,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'PLDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) pldd_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'PLDD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) pldd_comp,
                (SELECT jep_code_28
                   FROM gnfo_report_asr
                  WHERE order_no_10 = g1.order_no_10
                    AND event_25 = 'PLDD'
                    AND ROWNUM = 1) pldd_jep,
                TO_CHAR ((SELECT due_date_26
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'CTD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) ctd_due,
                TO_CHAR ((SELECT comp_date_27
                            FROM gnfo_report_asr
                           WHERE order_no_10 = g1.order_no_10
                             AND event_25 = 'CTD'
                             AND ROWNUM = 1),
                         'MM/DD/YYYY'
                        ) ctd_comp,
                (SELECT jep_code_28
                   FROM gnfo_report_asr
                  WHERE order_no_10 = g1.order_no_10
                    AND event_25 = 'CTD'
                    AND ROWNUM = 1) ctd_jep,
                TO_CHAR (g1.order_create_date_24, 'YYYY') YEAR
           FROM gnfo_report_asr g1
 
Keywords: tune the query ( distinct )
 
Loading Advertisement...
 
[+][-]09/15/08 12:51 PM, ID: 22482210

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle 9.x, Oracle Database, Oracle 10.x
Tags: oracle
Sign Up Now!
Solution Provided By: DiscoNova
Participating Experts: 3
Solution Grade: A
 
 
[+][-]09/15/08 07:42 PM, ID: 22484452

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]11/04/08 12:37 AM, ID: 22874376

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]12/13/08 06:13 PM, ID: 23166244

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]12/18/08 03:37 PM, ID: 23208972

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 / EE_QW_2_20070628