How to make a query faster
Hi all
I have almost the same query running in different databases. However, a database is display results faster than others. Please advise how I can improve performance.
Original request: (counting the seconds 126,507)
Select / * + parallel(ir,8) * /.
-case when generic_text3 = "GBP" then "GBP" to another end 'USD' currency.
sum (case when generic_text1 = 'Y' or ebook_flag = 'Y' or generic_text10 = 'Y' then 1 else 0 end) as digital_ct,
sum (case when generic_text4 = 'Y' then 1 else 0 end) as nook_ct,
Count (*) CT
to ind_retail ir
where VIRTUAL_TABLE_ID = 11236
and import_ts between last_day (add_months (trunc (sysdate),-2)) + '1' INTERVAL DAY and last_day (add_months (trunc (sysdate),-1)) + '1'-DAY INTERVAL
Group case when GENERIC_TEXT3 = "GBP" then "GBP" other end "USD";
query must work on (counting the seconds 492,569)
Select / * + PARALLEL (DHV, 16) * /.
case when TEXT_0050 = "GBP" then "GBP" end "USD" another as CURRENCY - Currency Code - H
SUM (case when TEXT_0270 = 'Y' or TEXT_0062 = 'Y' or TEXT_0375 = 'Y' then 1 else 0 end) as DIGITAL_CT, - Ebook Nook App flag flags and - video corner
sum (case when TEXT_0025 = 'Y' then 1 else 0 end) as nook_ct,-flag Nook
Count (*) CT
Of
CORE. DATA_HEADERS1_HIST
where VIRTUAL_TABLE_ID = 11236
and import_ts between last_day (add_months (trunc (sysdate),-2)) + '1' INTERVAL DAY and last_day (add_months (trunc (sysdate),-1)) + '1'-DAY INTERVAL
Group case when TEXT_0050 = "GBP" then "GBP" other end "USD";
The structure of the table are the same for both tables they have partition by virtual_table_id and index on import_ts.
Thank you
FB
Sorry I had no access to explain plan. However, I tune up very well using the following sql indicator
Select / * + FULL (DHV) PARALLEL (DHV, 8) * /.
case when TEXT_0050 = "GBP" then "GBP" end "USD" another as CURRENCY - Currency Code - H
SUM (case when TEXT_0270 = 'Y' or TEXT_0062 = 'Y' or TEXT_0375 = 'Y' then 1 else 0 end) as DIGITAL_CT, - Ebook Nook App flag flags and - video corner
sum (case when TEXT_0025 = 'Y' then 1 else 0 end) as nook_ct,-flag Nook
Count (*) CT
Of
CORE. DATA_HEADERS1_HIST
where VIRTUAL_TABLE_ID = 11236
and import_ts between last_day (add_months (trunc (sysdate),-2)) + '1' INTERVAL DAY and last_day (add_months (trunc (sysdate),-1)) + '1'-DAY INTERVAL
Group case when TEXT_0050 = "GBP" then "GBP" other end "USD";
Tags: Database
Similar Questions
-
How to make the query more efficient
Hi all
I use the following query in my app that works very well. Although I'm not an expert in PL/SQL, can someone please suggest how can I make the query more efficient? Because I use the same contract for every query table. Only difference is that in the name of the condition column. Again I am showing same column comments for each request. I was wondering if I can join these 3 and do 1 single request if possible
DECLARE v_CONTRACTNO varchar2(100); v_CHILDCONTRACTNO varchar2(100); v_SOURCESYSTEM varchar2(100); BEGIN begin SELECT comments into v_CONTRACTNO from user_col_comments where TABLE_NAME = 'CONTRACT' and COLUMN_NAME = 'CONTRACTNO'; end; begin SELECT comments into v_CHILDCONTRACTNO from user_col_comments where TABLE_NAME = 'CONTRACT' and COLUMN_NAME = 'CHILDCONTRACTNO'; end; begin SELECT comments into v_SOURCESYSTEM from user_col_comments where TABLE_NAME = 'CONTRACT' and COLUMN_NAME = 'SOURCESYSTEM'; end; END;
Thanks in advance...
Concerning
Nabila
Hi, Nabila,
The nabila Islam wrote:
Hi all
I use the following query in my app that works very well. Although I'm not an expert in PL/SQL, can someone please suggest how can I make the query more efficient? Because I use the same contract for every query table. Only difference is that in the name of the condition column. Again I am showing same column comments for each request. I was wondering if I can join these 3 and do 1 single request if possible
- DECLARE
- v_CONTRACTNO varchar2 (100);
- v_CHILDCONTRACTNO varchar2 (100);
- v_SOURCESYSTEM varchar2 (100);
- BEGIN
- Start
- SOME comments
- in v_CONTRACTNO
- of user_col_comments
- where TABLE_NAME = 'CONTRACT '.
- and COLUMN_NAME = 'CONTRACTNO ';
- end;
- Start
- SOME comments
- in v_CHILDCONTRACTNO
- of user_col_comments
- where TABLE_NAME = 'CONTRACT '.
- and COLUMN_NAME = 'CHILDCONTRACTNO ';
- end;
- Start
- SOME comments
- in v_SOURCESYSTEM
- of user_col_comments
- where TABLE_NAME = 'CONTRACT '.
- and COLUMN_NAME = 'SOURCESYSTEM ';
- end;
- END;
Thanks in advance...
Concerning
Nabila
Of course, you can get all 3 values in a query. Here's one way:
SELECT contractno, childcontractno, sourcesystem
IN v_contractno, v_childcontractno, v_sourcesystem
Of user_col_comments
PIVOT (MIN (comments)
FOR column_name IN ('CONTRACTNO' AS contractno
'CHILDCONTRACTNO' AS childcontractno
'SOURCESYSTEM' AS sourcesystem
)
)
WHERE table_name = 'CONTRACT '.
;
But I doubt that it makes things very slow. If your PL/SQL performance is poor, I suspect that the cause is somewhere that you haven't posted.
-
How to make the query AS a parameter inside... ?
Hello all :)
I want to create the view object, where the query using oracle AS with the value of the parameter inside (variable binding), like this:
SELECT WhLokasi.LOKASI_ID,
WhLokasi.DESKRIPSI,
WhLokasi.BARIS_KE,
WhLokasi.KOLOM_KE,
WhLokasi.SUBKOLOM_KE
OF WH_LOKASI WhLokasi
WHERE AS WhLokasi.DESKRIPSI * 'setting' * AND WhLokasi.BARIS_KE AS * 'parameter. "
someone help me... Please... : d
THX
agungdmtHi agungdmt,
You have several options which are all explained in the developersguide.
First use a bindvariable and encode the LIKE statement in the where clause of your viewObject (Dev Guide Chapter 5.10.1 how to add Variables to link to a definition of view object).
It also shows an exampleselect PERSON_ID, EMAIL, FIRST_NAME, LAST_NAME from PERSONS where (upper(FIRST_NAME) like upper(:TheName)||'%' or upper(LAST_NAME) like upper(:TheName)||'%') and PERSON_ID between :LowUserId and :HighUserId order by EMAIL
Second option is to create and use named viewCriteria (5.11.1 how to create named view declaratively criteria).
Third, and I think that this is not what you need at the present time, is to add where clause when executing (5.10.5 How to add a WHERE Clause with named Bind Variables when running)
If I where you, I would choose the first or second option.
Good luck
Luc Bors
-
How to make my load fast mac at startup?
Hi, I noticed that my mac takes a lot of time to load at startup, I wonder if there are somethings I can for my mac to fast load at startup.
Select Macintosh HD as the startup disk.
'The value default startup disk' http://support.apple.com/kb/HT1310
Reset the PRAM. http://support.Apple.com/kb/PH18761
Reset the SMC. Choose the appropriate method.
https://support.Apple.com/en-us/HT201295
Boot mode safe. http://support.Apple.com/en-us/HT1564
-
Excell using only 1 quad core, how to make it run faster?
Hello I'm in Excel with a certain calculation. It's very slow, because using only 1 on the quad core dell E6510. I already change the priority, but it changes nothing. affinity, the 4 cores are available for Excel. I have Excel 2007 with windows XP for 64-bit. What can I do to get runnign excell faster and use more memory?
See the section called "MTC" in http://msdn.microsoft.com/en-us/library/office/ff700514.aspx
If this does not help, re - ask your question in forum Excel 2007.
-
How to make the query in a single query? No Union only please...
Hello
I have a series of about 18 queries that find charges in many scenarios. I wanted to have a single query to do this. which displays the result in a single line. Is it possible, I heard analytical functions are good options, but I am new to Oracle. Please help me.
Select count (*) total_count emp; -100
Select coun (*) MGR_count emp where job = "MGR" - 10
Select count (*) dept_count emp where deptno in (10,20) - 75
output...
----------
TOTAL_COUNT MGR_COUNT DEPT_COUNT
100 10 75Thank you
Hello
Here's one way:
SELECT COUNT (*) TOTAL
, COUNTY (CASE job WHEN = END "MGR", 1) AS mgr_count
, COUNT (CASE WHEN deptno IN (10, 20) THEN 1 END) AS dept_count
FROM table_x
;
Instead of putting the conditions in a clause WHERE (where they would exclude whole lines), put the conditions in a CASE expression, where they affect only this column.
-
How to call a query of the support bean?
Hi all
Another question for you guys:
I did a page jspx with an entry form and a "submit" button.
When I click the button submit, the action in my grain of support my_action is executed.
This is the code:
public BindingContainer {} getBindings()
Return BindingContext.getCurrent () .getCurrentBindingsEntry ();
}
public String my_action() {}
BindingContainer links = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("EmployeesView");
Object result = operationBinding.execute ();
If (! operationBinding.getErrors () .isEmpty ()) {}
Returns a null value.
}
}
I was hoping that the "EmployeesView" query has been run in this way, but I get the following exception:
java.lang.ClassCastException: oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding cannot be cast to oracle.binding.OperationBinding
So how should I run query EmployeesView?
Second part of the question: what happens if I typed the name of the employee in my form, and I want to
run a query that selects all employees with the same name?
How to make a query with a variable as input in the WHERE clause?
Thanks in advance.
Published by: Facehugger on 7-apr-2010 11:15In this case use example 9-13, access to the Interface of Client Application Module in a JSF Backing Bean using a link of Action named:
http://download.Oracle.com/docs/CD/E15523_01/Web.1111/b31974/bcservices.htm#sthref918So rather than get an operation binding - get you the pointer to the AM across the link - line 4.
Then on the AM you can call the service method, or instead, use the findViewObject method to locate your specific VO, change and then run the query on the matter. Then, wrap everything in the VO.hasNext () and use the following method on your VO for the data lines.
And then you are iterating over the lines of the VO and add them to any list/collection you pass to the BPEL.This video could help in terms of interaction with a VO and get the lines:
http://www.YouTube.com/watch?v=bgawJD4yPeY&feature=youtube_gdata -
How can I make Photoshop run faster, or how to increase performance?
Hello
How can I make Photoshop run faster, or how to increase performance?
Help, please.
Kind regards
Techvedic
Nice day!
Please read this:
Optimize performance. Photoshop CS4, CS5, CS6, CC
If you have any additional questions, please read this (specifically"to provide relevant information to get faster answers" "):
http://forums.Adobe.com/docs/doc-2325
Kind regards
Pfaffenbichler
(edited)
-
How to make this simple sql run faster?
Here is a very simple sql, but it takes too long to finish as an hour or more, and the problem is in the table. It's a huge table with 17660025 lines.
In addition, upd_dt is indexed.
Execution plan seems to be no problem: (is 9i, and I do not think that it would not perform better if the UNIQUE HASH is used instead of SORT UNIQUE)select distinct (dstn_type) from ims_ets_prty_msge where ims_ets_prty_msge.upd_dt > sysdate - 30;
Here is some info on the table----------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost | ----------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 6 | 78 | 1409 | | 1 | SORT UNIQUE | | 6 | 78 | 1409 | | 2 | TABLE ACCESS BY INDEX ROWID| IMS_ETS_PRTY_MSGE | 856K| 10M| 10 | |* 3 | INDEX RANGE SCAN | IMS_ETS_PRTY_MSGE_INDX5 | 154K| | 2 | ----------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("IMS_ETS_PRTY_MSGE"."UPD_DT">SYSDATE@!-30) Note: cpu costing is off
The thing is that we must make it run faster.NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN 17129540 455259 622 502 455278 188
And all I can think is to create a bitmap on dstn_type (low cardinality) index and partition the table using upd_dt;
So my question would be is anyway that we can get a better response time without having to make that kind of change?
Or is this kind of change really help?
Any thoughts would be appreciated!
Thank youHave you thought about putting an index on (upd_dt, dstn_type)?
With the query you posted, and this index, it should be possible to use a full scan of the index, no visit to the table at all.
A bitmap index would not be a good idea, if it is an OLTP application / table.
-
(Updated report) SQL query - may not know how to make one
Hi people,
Can someone tell me how to make a report where the data can be updated? Not an interactive report, SQL report that selects a single row. The only options in the menu dropdown I see are "SQL query" and 'SQL Query (body of function from PL/SQL returning SQL query)', but I have a report elsewhere that says: this type are "SQL Query (updated report)", but I do not remember how :(
Thank you very much
-AdamHi Adam,.
An updated report is a 'tabular form' - see: http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/frm_tabular.htm#CHDFBHDB
Andy
-
HP Pavillion MS235: HP Pavillion MS235 All in One - how to make it faster?
I would like to make the PC faster. We had for some time, there isn't much about it then, but I would like to give to my son for his school work and games. It's just slow. Everything you do, takes so long. No viruses have WebRoot on it. Any ideas or advice?
The concept of the IOA is done for convenience. I look at the specifications. Its processor is a 1.6 Ghz chip, RAM (memory) is maximum at 4 GB. It has never considered a game machine with this configuration. You can not change anything.
-
How to make fast-forward/reverse fast functions when you use VideoDisplay
I use 'VideoDisplay' forum for progressive download of the videoes from a server. Is anyone know how to add functions to fast-forward/reverse fast using Actionscript 3 with VideoDisplay object?
or is it all still to do when reading videoes by progressive download?
Thanks in advance.I guess that for fast forward/backward you talk more than a simple binding position of the VideoDisplay to a slider control. There's a thread here interesting Rewind:
http://www.ActionScript.org/forums/showthread.php3?t=161866
HTH,
Matt Horn
Flex docs -
How to make a profile on my Facebook photo in jpeg or gif format?
How to make a profile on my Facebook photo in jpeg or gif format?
Hello
1. what operating system you are using on the computer?
2. are you trying to download or trying to convert the image format?
Alternatively, you can view the query on the forum of Facebook to improve the assistance:
http://www.Facebook.com/help/ -
I accidentally put my pictures folder in the bin and emptied. How to make a comeback?
II accidentally put my pictures folder in the bin and emptied! How to make a comeback?
If they are not in your Recycle Bin, restore it from your backup.
If you do not have backups, then you will need to use the specialist recovery software (search the Web) yourself or get a professional company to do it for you at great expense. The most important thing to remember here is that after you have deleted your files, they still exist, but are considered as a free space on your hard drive and can so be replaced by your PC at any time - use your PC only so much it is necessary to recover the files. The more you use your PC more the chances of your files become corrupted and unrecoverable.
Some people recommend
http://www.Piriform.com/Recuva
recovery software. However, I have not used, so I can't personally recommend.
For later use, if anything either on your PC is valuable or irreplaceable, you must save it to a separate drive. Hard drives are mechanical devices with very fast moving parts that can fail without warning at any time. There are many other ways to lose too much data.
-
How to make a music video .vob to work in movie maker? __
Remember - this is a public forum so never post private information such as numbers of mail or telephone!
Ideas:
- You have problems with programs
- Error messages
- Recent changes to your computer
- What you have already tried to solve the problem
========================================
First you try to rename the .vob to .mpg or .avi file and try
to import... If Movie Maker accepts the file, drag it on the timeline
and publish (save) in .wmv format in a folder on your hard drive
drive. Then re-import the .wmv file and you are ready to change.In addition, you will need software to convert the .vob file to the
.wmv format. The following freeware can be worth a try:SUPER
Universal Player Encoder & Renderer
http://www.videohelp.com/tools/Super
(the download mirror site is faster)(FWIW... it is always a good practice to create one)
System restore point before installing new software)After installing the program GREAT... open...
you will see two small circles at the top left
corner of the screen... check the UPPER circle.Now... Drag/Drop your. VOB file in the current field.
Output container... Choose wmv...
Video scale size / no change
Left, click the Encode button.
Choice: A Simple Profile / OK...
Wait... wait longer...
(FWIW... I have better luck with video if I'm not
try to multi-task while a file is being converted)When the file is converted, you should find it in...
Program Files / eRightSoft / Super / exit.Or... you can type... CTRL + O.. o open the Save
Window and choose a backup folder.Good luck...
Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.
Maybe you are looking for
-
Is it possible to transfer a conversation iMessage from my iPhone to my Mac?
Hi all... I was wondering if someone could help me with the problem of having an iMessage conversation dating back months my phone is off and as a result of my Macbook. My iPhone is running iOS 9.3.3 and my Macbook is running 10.7.5. It would be g
-
Satellite L750 - Lag latency of registration issue
MY PROBLEM. I used my desktop pc to record guitar on a pre backing track recorded using programs: fruity-loop, Audacity etc. without problem. When I try the same on my laptop the problem of latency L750 does not listen to what I play it IE 0.5 second
-
FN + f5 will not turn on wifi
I did a clean install of windows 7 on a L512 I bought without operating system on it. I installed different drivers, but so far I can't get wifi to turn on with switch function as it should. This seems not to be a rare problem and it seems to be on t
-
Can a family sharing in the iCloud backup (only apple ID which is at the head of the family action plan)?
-
By pressing 'Ctrl' key stop my VI
Hi all My VI stop responding when I press a special key. Try to run my VI attached to this post. While the VI is running, press any button on the arrow, and you can see that the value of the indicator "Horizontal" and "Vertical" changes accordingly.