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

  • Home
  • SEARCH
  • 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 92741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:14:05+00:00 2026-05-10T23:14:05+00:00

What SQL query shows me the tables & indexes used by a view on

  • 0

What SQL query shows me the tables & indexes used by a view on Informix?

I know how to find the ‘original create statement’ for a view in SYS_VIEWS, but that requires a human brain scanning/grokking that select. I believe I can find if the tables are indexed, once they have been identified.

Background: I need to make certain that some critical views point to current (e.g. after being ‘reorganized’) tables. Too often I have seen views pointing to old backup tables, that were no longer indexed, and took forever to query.

I need to identify these queries regularly and ‘remind’ the tuning DBA to rebuild the views/indexes.

  • 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. 2026-05-10T23:14:05+00:00Added an answer on May 10, 2026 at 11:14 pm

    The table sysdepend documents view dependencies. The columns are:

    • btabid – base table ID number
    • btype – normally T for table or V for view
    • dtabid – dependent table ID number
    • dtype – normally T for table or V for view

    Consequently, for a given view with tabid N, you can write:

    SELECT b.owner, b.tabname, d.*     FROM 'informix'.systables b, 'informix'.sysdepend d     WHERE d.dtabid = N       AND d.btabid = b.tabid; 

    If you only know the view name, then determining the view’s tabid is surprisingly tricky if your database is a MODE ANSI database where you may have multiple tables with the same table name (or view name in this case) but each with a different owner. However, in the usual case (a non-ANSI database, or a unique table/view name), the query is easy enough:

    SELECT b.owner, b.tabname, d.*     FROM 'informix'.systables b, 'informix'.sysdepend d     WHERE d.dtabid = (SELECT v.tabid FROM 'informix'.systables v                          WHERE v.tabname = 'viewname'                      )       AND d.btabid = b.tabid; 

    The question asks about the indexes used by a view. Indexes are not used by a view, per se; indexes are used by the query engine when processing a query, but the indexes used could change depending on the total query – so different indexes might be used for these two queries:

    SELECT * FROM SomeView;  SELECT * FROM SomeView     WHERE Column1 BETWEEN 12 AND 314; 

    The indexes that will be used are not recorded anywhere in the system catalog; they are redetermined dynamically when a statement is prepared.

    The question also notes:

    Background: I need to make certain that some critical views point to current (e.g. after being ‘reorganized’) tables. Too often I have seen views pointing to old backup tables, that were no longer indexed, and took forever to query.

    How do you do your reorganization? Do you create a new table with the desired structure, copy the data from old to new, then rename old, rename new? That probably would be the explanation – the table renaming reworks the views that reference the table. What form of reorganization are you doing? Can you use a different technique? A classic standby is to use ALTER INDEX indexname TO CLUSTER (after altering it to NOT CLUSTER if it was already clustered). This rebuilds the table and the indexes – without the views breaking. Alternatively, you can consider an ALTER FRAGMENT operation.

    It also seems a bit odd to keep the old tables around. That suggests that your reorganization is more a question of dropping old data. Maybe you should fragment your table by date ranges, so that you detach a fragment when it has reached its ‘end of useful life’ date. Dropping the tables would also drop the views that depend on it, ensuring that you rebuild the views with the new table names.

    Another alternative, therefore, is to simply ensure that the reorganization drops and recreates the views.

    I need to identify these queries regularly and ‘remind’ the tuning DBA to rebuild the views/indexes.

    Worrisome…it should just be part of the standard procedure for completing the reorganization. Basically, you have a bug to report in that procedure – it does not ensure that the views are fully operational.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 97k
  • Answers 97k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When and where needed. There is no point on refactoring… May 11, 2026 at 7:23 pm
  • Editorial Team
    Editorial Team added an answer If your business requirements state that no other DiaryMode is… May 11, 2026 at 7:23 pm
  • Editorial Team
    Editorial Team added an answer They are equivalent for all intents and purposes. If you… May 11, 2026 at 7:23 pm

Related Questions

We've been doing some testing with ColdFusion and MySQL and are a bit puzzled.
I have a query that looks like this: SELECT OrganizationName, OrganizationID, ReceivableStatus, InvoiceFee FROM
I have two database tables, Categories and SuperCategories, for an inventory control system I'm
I know that that is not a question... erm anyway HERE is the question.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.