Home » SQL & PL/SQL » SQL & PL/SQL » Problem with performance (oracle 11g)
Problem with performance [message #574797] Tue, 15 January 2013 21:51 Go to next message
aditya_4136
Messages: 2
Registered: January 2013
Location: Bangalore
Junior Member
Hi,

I wanted to display distinct no of jobs in a company so I wrote a query as shown below

select count(distinct job) from emp;

This query works fine but my client is asking me to write a query with better performance. Can anyone guide me in as to how this query performance is bad and what will be the other query for me to run this faster.

Thanks in Advance.
Re: Problem with performance [message #574800 is a reply to message #574797] Tue, 15 January 2013 22:08 Go to previous messageGo to next message
BlackSwan
Messages: 22781
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/

does JOB column have an index on it?
Re: Problem with performance [message #574802 is a reply to message #574800] Tue, 15 January 2013 22:58 Go to previous messageGo to next message
aditya_4136
Messages: 2
Registered: January 2013
Location: Bangalore
Junior Member
Hi,

Thanks for the replay. The job column does not have an index on it. My clients says that he just needs another query which will get the work done faster for him. He requires another query and he is not getting convinced with what ever I tell him.

Regards,
Aditya
Re: Problem with performance [message #574804 is a reply to message #574802] Tue, 15 January 2013 23:06 Go to previous messageGo to next message
BlackSwan
Messages: 22781
Registered: January 2009
Senior Member
ORAFAQ tuning below -
Since NOBODY can optimize SQL just by looking at it, we need a few more details.
http://www.orafaq.com/forum/m/433888/136107/#msg_433888
Please refer to URL above & be sure to provide the details requested:
1) DDL for all tables & indexes
2) EXPLAIN PLAN
3) output from SQL_TRACE & tkprof
Re: Problem with performance [message #574810 is a reply to message #574797] Wed, 16 January 2013 00:23 Go to previous message
Michel Cadot
Messages: 59087
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
select count(distinct job) from emp;

This query works fine but my client is asking me to write a query with better performance.


select job_name from jobs;


Regards
Michel
Previous Topic: XML : Union of 2 Select queries
Next Topic: Sql for previous day/ day before previous day
Goto Forum:
  


Current Time: Tue Sep 16 20:40:18 CDT 2014

Total time taken to generate the page: 0.05382 seconds