Problem indexing and performance does not help

I created a SQL view is basically simple, but I need to group data based on a value returned by a function. I think this slows down the performance. First, I added a normal index on it, then added that an index function but no help. I get the data I need, but it takes too much time. I hope someone can give me some ideas on how to optimize the performance of my SQL.

The base table has 1318408 rows. I need to select only a few columns and group and count the rows based on a date value in a column. However, the date of the table contains only a weekend rental value and I need report of the neighborhoods. The report should as well a date and value of a text value for the quarter. So I created two functions that accept a date value and return a date value for the start date of the quarter and a text value for the quarter, that the date falls in respectively; my SQL is like this:

Select
GLC_DATE2CAL_QRT_STARTDATE_FN (s.work_week_end_date) cyquarter_start_date,
GLC_DATE2CAL_QRTYR_FN (s.work_week_end_date) cyquarter_text,
s.Ethnicity ethnicity_code,
and. Description ethnicity_desc,
County (unique employee_id) number_employees
of s cpr_employees_snapshot, ct_vendor_ethnicities and
and trim (s.ethnicity) = et.ethnicity_id
Group GLC_DATE2CAL_QRT_STARTDATE_FN (s.work_week_end_date), GLC_DATE2CAL_QRTYR_FN (s.work_week_end_date), s.ethnicity, et.description

This takes about 1 1/2 minutes to recover data

When I do not use the functions and run this SQL:

Select
s.work_week_end_date,
s.Ethnicity ethnicity_code,
and. Description ethnicity_desc,
County (unique employee_id) number_employees
of s cpr_employees_snapshot, ct_vendor_ethnicities and
and trim (s.ethnicity) = et.ethnicity_id
Group of s.work_week_end_date, s.ethnicity, et.description

It takes 7 seconds.

Hello

Welcome to the forum!

You feel the change of context, where you constantly change between SQL and PL/SQL. That always takes time.

A function-based index can help if you have referenced only functions in the WHERE clause. Given that you use in the SELECTION and GROUP BY clauses, it cannot help.

What are the functions? Maybe you could calculate their in a subquery, with pure SQL expressions.

From Oracle 11, you can have virtual columns that are computed when you INSERT or update each line and physically stored in the table.
In previous versions of Oracle, you can get the same results with a materialized view, or a BEFORE INSERT trigger that calls the functions and meets the additional columns.

Tags: Database

Similar Questions

Maybe you are looking for

  • PowerEdge T110ii using PERC S100 for RAID 10

    I read that I can use S100 to implement a RAID 10. I bought 4 new drives (1 TB). I have installed in the system. They're all here and work. I went to the disk installation and created the virtual and selected drive all THE DRIVES and RAID 10. I then

  • HELP the call Video Editor - problem

    I followed all the formats here https://developer.BlackBerry.com/native/documentation/Cascades/device_platform/invocation/video_edit... When this function is executed, the screen fades a bit then goes back to a normal screen brightness. This means he

  • My KEY will not work for both windows 7 32-bit update and 64-bit version?

    I have two, a copy and a key for the upgrade to Windows 7, 32-bit and 64-bit.  (Key separately for each version, purchased about 6 months apart.) The computer that is running the 32-bit version had a hard drive failure.   After replacing the hard dri

  • Mail merge for names with titles cover letter and without

    This is a merger and mailing which suffers from a disease. It's a cover letter, then it starts with "Dear," as Express.ypH below.As you can see the expensive of course is static and the title, L_name are all variables. Now, there must be a space betw

  • The horizon - fatal error Client error CHECK prefs.cpp:1311

    When installing VMware Horizon Client 3.5.2 on my 10 Windows PC, I got the error:VMware Horizon Client fatal error: (crtbora)Verifier.\prefs.cpp:1311After Googling for it, it seems to be a known issue since mid-September of this year, 2015.I also ins