Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 660449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:09:26+00:00 2026-05-13T23:09:26+00:00

I have a self referencing table in Oracle 9i, and a view that gets

  • 0

I have a self referencing table in Oracle 9i, and a view that gets data from it:

CREATE OR REPLACE VIEW config AS
SELECT c.node_id,
       c.parent_node_id,
       c.config_key,
       c.config_value,
       (SELECT c2.config_key 
          FROM vera.config_tab c2 
         WHERE c2.node_id = c.parent_node_id) AS parent_config_key,
       sys_connect_by_path(config_key, '.') path,
       sys_connect_by_path(config_key, '->') php_notation
  FROM config_tab c
CONNECT BY c.parent_node_id = PRIOR c.node_id
 START WITH c.parent_node_id IS NULL
 ORDER BY LEVEL DESC

The table stores configuration for PHP application. Now I need to use same config in oracle view.

I would like to select some values from the view by path, but unfortunately this takes 0,15s so it’s unacceptable cost.

SELECT * FROM some_table
 WHERE some_column IN (
   SELECT config_value FROM config_tab WHERE path = 'a.path.to.config'
 )

At first I thought of a function index on sys_connect_by_path, but it is impossible, as it needs also CONNECT BY clause.

Any suggestions how can I emulate an index on the path column from the ‘config’ view?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:09:27+00:00Added an answer on May 13, 2026 at 11:09 pm

    If your data doesn’t change frequently in the config_tab, you could use a materialized view with the same query as your view. You could then index the path column of your materialized view.

    CREATE MATERIALIZED VIEW config
       REFRESH COMPLETE ON DEMAND 
       AS <your_query>;
    
    CREATE INDEX ix_config_path ON config (path);
    

    Since this is a complex query, you would need to do a full refresh of your materialized view every time the base table is updated so that the data in the MV doesn’t become stale.

    Update

    • Your column path will be defined as a VARCHAR2(4000). You could limit the size of this column in order to index it. In your query, replace sys_connect_by_path(...) by SUBSTR(sys_connect_by_path(..., 1, 1000) for example.
    • You won’t be able to use REFRESH ON COMMIT on a complex MV. A simple trigger won’t work. You will have to modify the code that updates your base table to include a refresh somehow, I don’t know if this is practical in your environment.
    • You could also use a trigger that submits a job that will refresh the MV. The job will execute once you commit (this is a feature of dbms_job). This is more complex since you will have to check that you only trigger the job once per transaction (using a package variable for example). Again, this is only practical if you don’t update the base table frequently.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a self referencing table named categories that has a parentcategoryid column that
I have a table that has an Self referencing relationship - One Wall comment
I have a self-referencing table (Customers) and a table that will link to one
I have implemented a linked list as a self-referencing database table: CREATE TABLE LinkedList(
I have a self referencing table and I want a mysql query that will
I have a table in my source DB that is self referencing |BusinessID|...|ParentID| This
I have a table called Metrics that is a self-referencing table. Meaning it has
i have a self referencing table called project that has a master detail relationship
I have a simple self referencing table as depicted here: CREATE TABLE [dbo].[Project]( [ProjectId]
I have a database table called item that has a self-referencing field called itemParentID.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.