Disable & enable of Index in db2luw - db2

is it possible to temporarily disable & again enable of an index on a table in db2luw.
If so can some one tell me the syntax or process, to achieve this.
I am updating tons of records . Before that I have to disable all the indexes on all the tables & after that have to create only one user created index (I9) on all the tables. My update query has to be run only with one index(I9).
When once my update query got completed. again I have to reset all the tables to their original position(previous indexes).
I am very new to db2. kindly excuse me if I am wrong at any stage in my question.
That is what I am trying to find.
If you have a better solution for this, can you please let me know.It l be a very good favour.
Thanks

You can't "disable" an index. Please see DROP INDEX <name> and CREATE INDEX <name>.

Related

INTERBASE - INDEX ISSUE

Good day,
I run many databases under interbase XE7 and 2017 now.
Lately, I got a strange behavior on one of the db:
A table with a primary key was found hosting many rows with similar values, like image below.
We can see that SCRIPTTYPE is a primary key column and it contains many times MATRIX, no space or strange characters ( I checked).
I was able to backup / restore without issues.
I am puzzled by this and I am wondering if anybody did encountered something similar?
And how it was done?
Thanks.
enter image description here
Run this query to be sure:
select SCRIPTTYPE, count(*)
from yourtable
group by SCRIPTTYPE
order by 2 desc
If you get a count>1, then I'd argue it's simple a bug and you should contact support. For them to assist you they'll almost certainly need your database, so you should be prepared to provide that. Based on your description, you should be able to drop all tables except the one, and drop all fields except your key, then backup and restore to get the simplest test case.

Results given by stored procedure aren't editable

I would love to have a stored procedure which returns a selection which is editable in phpadmin. For example, something as simple as
SELECT * FROM students
written from the console will allow you to edit the records as far as each row is unique (table with a primary key). However, that same statement within a procedure won't allow it!
The point is that I have a selection that I will be using quite often and it's a bit more complex than the one above. If I copy it and paste it on the console, it's fine, but not so when run from a procedure!
I would appreciate any ideas to work around this limitation.
Thank you in advance!
Thanks to those who read my question. I just figured out that a very simple way to solve this issue is to create a table with my output selection. Then, from the console, I can select and edit whatever I need from that temporary table.
Thanks for your time!

Inserting a record into Top of Table

Hopefully an easy question for someone with more experience than me. I have a stored procedure that Inserts records into a table. Like all databases that I have worked with, when you insert a record it inserts it into the bottom of the table. I would like to insert it to the top of the table and then move all the existing records down by one (I assume this would happen automatically with the insert).
I want to to do this because I'm using the 'Top #' keyword. I am pretty sure that I could just leave it the way it is, and instead of using the 'Top" keyword, I could use the 'Bottom" keyword. But I want to make it easier for people reading it that aren't familiar with it, so they can instantly see the newest entries. I'm going to keep researching this on my own, but If someone knew off the top of their head and could save me the time that would be appreciated.
is there any incremental id on that table.If yes then create clustered index on that id with descending order

Sphinx search debugging

We use Sphinx Search at work but and I am having an issue with a new index I'm setting up. Does anyone know of a tool or technique that so I can look at the data stored in Sphinx?
Basically I want to do something like - "show me the first 5 records in index 'X'", just to be sure that it is actually storing data. At the moment I'm about 90% sure that my query code is correct but have no way of knowing that my index is correct.
Cheers
*SELECT * FROM index_name* on Sphinx side should give you a list of IDs. This required MySQL protocol support to be enabled in Sphinx conf file:
listen = 9306:mysql41
To Find Ids in index, you can do this:
/usr/local/sphinx/bin/indextool -c /usr/local/sphinx/etc/sphinx.conf --dumpdocids indexname

Postgres full text search across multiple related tables

This may be a very simplistic question, so apologies in advance, but I am very new to database usage.
I'd like to have Postgres run its full text search across multiple joined tables. Imagine something like a model User, with related models UserProfile and UserInfo. The search would only be for Users, but would include information from UserProfile and UserInfo.
I'm planning on using a gin index for the search. I'm unclear, however, on whether I'm going to need a separate tsvector column in the User table to hold the aggregated tsvectors from across the tables, and to setup triggers to keep it up to date. Or if it's possible to create an index without a tsvector column that'll keep itself up to date whenever any of the relevant fields in any of the relevant tables change. Also, any tips on the syntax of the command to create all this would be much appreciated as well.
Your best answer is probably to have a separate tsvector column in each table (with an index on, of course). If you aggregate the data up to a shared tsvector, that'll create a lot of updates on that shared one whenever the individual ones update.
You will need one index per table. Then when you query it, obviously you need multiple WHERE clauses, one for each field. PostgreSQL will then automatically figure out which combination of indexes to use to give you the quickest results - likely using bitmap scanning. It will make your queries a little more complex to write (since you need multiple column matching clauses), but that keeps the flexibility to only query some of the fields in the cases where you want.
You cannot create one index that tracks multiple tables. To do that you need the separate tsvector column and triggers on each table to update it.