ba6.us - Dave's Database Related Stuff

  • home
  • blog
  • notebooks
  • projects
  • recent
  • about
  • manifesto
  • !
Home

Tag Cloud

apex Application Express Auditing data dbi development export funnies HTML Java linux monitoring oem oracle performance perl rman scripting sql SQL Developer sqlplus tuning unix windows
more tags

Search

RSS Feed

Blog Posts :

Navigation

  • Feed aggregator

User login

  • Request new password

sql

Quick filter for Application Express Reports

dmann — Mon, 12/05/2011 - 12:44

I normally get a lot of mileage out of Application Express interactive reports. Unfortunately there are some restrictions on the SELECT statements that can be used with them. Here is a demonstration of a technique I use when I want to add some interactivity to a plain old Apex report. I will create a Select List dropdown that submits and refreshes the report data automagically. The value in the select list will be applied as a filter to the report when it refreshes.

1) Create the Select List

• Items -> New Item -> Select List • Choose "Select List with Submit" • Next
Read more »
  • Application Express
  • sql
  • dmann's blog
  • Add new comment

HAVING & Bind Variables

dmann — Tue, 11/22/2011 - 17:34

Had an odd one come across my desk today. I have seen Bind variables used in the WHERE clause thousands of times. I have seen Binds in the SELECT lists hundreds of times. I have seen it used in the HAVING clause zero times... until today when it turns out it was causing a performance issue. With the Bind variable in the HAVING clause we were seeing an execution plan with lots of Full Table Scans and 12+ second runtimes. When editing the query and using a literal in the HAVING clause we saw 100ms or less performance and very efficient Execution Plans.
Read more »
  • bind variables
  • sql
  • dmann's blog
  • Add new comment

SQLDeveloper Used Defined Reports Pack

dmann — Thu, 11/10/2011 - 00:37

I have started a project to collect useful SQL Developer User Defined Reports. More info to follow after I complete a few check-ins.

https://github.com/dmann99/SQLDevUDRepPack

-Dave

  • reports
  • sql
  • SQLDeveloper
  • Add new comment

New Project: trc2sql.pl - Extract SQL from an Oracle Trace...

dmann — Fri, 10/14/2011 - 16:18

I started a new project for a utility I started writing. It has some basic functionality now but will probably increase in utility int he future.

It is a Perl script that extracts the SQL statements from an Oracle 10046 trace file. This is useful if you need to re-run SQL that was captured during a trace. It also helps reduce the amount of junk you have to slog through if you are interested in

trc2sql.pl - Extract SQL Statements From Oracle 10046 Trace File

-Dave

  • oracle
  • perl
  • sql
  • dmann's blog
  • Add new comment

SQL Tuning Advisor - what profile am I accepting?

dmann — Thu, 10/13/2011 - 12:35

When working on a SQL Tuning issue I often kick off a SQL Tuning Advisor job on the SQL while I gather info about statistics and other things I like to check when tuning. After I get an idea of where performance might be suffering I use the SQL Tuning Advisor results for a second opion. Unfortunately more often than not the SQL Tuning Advisor reports it can dramatically improve the performance of a SQL Statement by using a SQL Profile to force a different plan.
Read more »
  • oem
  • sql
  • tuning
  • dmann's blog
  • Add new comment

A SQL_ID by any other name... Same SQL / Different Tools / Different SQL_ID

dmann — Tue, 10/11/2011 - 22:33

I have been trying to chase down the same SQL being submitted against the same 10.2.0.4 Solaris database from different query tools used in our organization. I have been striking out when trying to match up with SQL IDs. I connected with 5 different tools (including SQLPLUS on 2 platforms) and submitted the following 4 lines of SQL:
SELECT *
  FROM EMP, 
       DEPT 
 WHERE EMP.DEPTNO=DEPT.DEPTNO
 Read more »
  • sql
  • dmann's blog
  • Add new comment

"There was a problem creating a SQL tuning task. ORA-13780: SQL statement does not exist. ORA-06512"

dmann — Tue, 07/26/2011 - 13:30

I recently got this error while trying to run a SQL Tuning Task against a SQL statement that was available in AWR but not currently in the library cache.

I got around it by locating the SQL in OEM and using SQL Worksheet to execute it: Read more »

  • oem
  • sql
  • tuning
  • dmann's blog
  • Add new comment

Functions in the WHERE clause...

dmann — Wed, 06/08/2011 - 15:34

Business logic. Sometimes it lives in the application, sometimes it lives in the database. I'll save the application/db argument for each individual case that I encounter. But if you do have significant business logic in your database, there will probably come a time when someone wants to incorporate some of that logic into a query they are writing. I am often asked to improve the speed of queries that have User Defined Functions (UDF) in the where clause. Sometimes I am successful at tuning them, sometimes a major structural or logic change is required to get good performance.
Read more »
  • function
  • sql
  • udf
  • dmann's blog
  • Add new comment

Oracle IN Condition and Multi Column Subqueries

dmann — Fri, 02/19/2010 - 15:02

I keep coming across a construct in some legacy SQL that has been causing all kinds of performance issues for us. I guess you could call it using the IN condition with multi-column subqueries. I located the syntax for the IN condition here but it doesn't really get into much detail about using this construct. Here is an example of the subquery (it returns the lowest salary and department_id for each department):
Read more »
  • oracle
  • sql
  • dmann's blog
  • 2 comments

Documented Hints available in 11.2...

dmann — Wed, 11/25/2009 - 11:53

As I get deeper into tuning with Statistics and the CBO I have been paying a lot more attention to hints. In the past I always tried to avoid hints. After working with the CBO and staistics in recent versions I believe they are necessary at times to give guidance to the CBO. The Oracle Database SQL Language Reference has a comprehensive list of hints included in the documentation of SQL Comments. The list for 11g is available here: link.
Read more »
  • Hint
  • sql
  • dmann's blog
  • Add new comment
  • 1
  • 2
  • next ›
  • last »
Syndicate content


Cornify
  • home
  • blog
  • notebooks
  • projects
  • recent
  • about
  • manifesto
  • !

Content Copyright 2006-2010. Links are copyright of respective owners.