If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Cluster/descending Index Issues

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-23-09, 11:40
informixdeveloper informixdeveloper is offline
Registered User
 
Join Date: Mar 2009
Posts: 9
Cluster/descending Index Issues

I have a customer master table with 420K+ rows.
About 30K customers have been active, the rest have been inactive for years.
My user insists on keeping the inactive customers on the master table.
So I added a status column char(1). If the row gets updated, LET status = "A".
Once a month we run, UPDATE customers SET status = "I" WHERE date_last_updated < (today - 365).
Table has: UNIQUE INDEX ON (customer_name); INDEX ON (status,customer_name)

When a customer arrives, a wildcard query is performed on the customer_name char(30) column: *LastName*SurName*First* (EXAMPLE: *RIVERA*RODR*P*) and status = "A".

So I CREATE CLUSTERED INDEX ON customers(date_last_updated desc) to physically
maintain the most recently active customer rows ahead of the inactive rows to improve query times and return less rows, but this actually made the queries
run slower!... Any ideas on how to best optimize this, other than moving inactives to another table?

---------------------------

Another perplexing result is that: I wanted to improve query time on
SELECT MAX(transaction_number) FROM transactions,

so i: CREATE UNIQUE INDEX ON transactions(transaction_number desc)

to quickly retrieve the MAX transaction_number, but it actually retrieves faster when the index is in ascending rather than descending order!!!
Reply With Quote
  #2 (permalink)  
Old 03-23-09, 11:54
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
There is no CREATE CLUSTERED INDEX in Oracle.

Additionally, the statement:
Code:
UPDATE customers SET status = "I" WHERE date_last_updated < (today - 365).
is not valid Oracle syntax.

As "I" is using double quotes, this means (to Oracle) I is a column.
Character literals need to be quoted using single quotes. With double quotes Oracle (and any DBMS compliant with the ANSI standard) will assume you are referencing a column (and I assume you don't have a column called I)

Secondly today is not a valid Oracle keyword.

Are you sure you are using Oracle?
Looks more like SQL Server to me.
Reply With Quote
  #3 (permalink)  
Old 03-23-09, 12:14
informixdeveloper informixdeveloper is offline
Registered User
 
Join Date: Mar 2009
Posts: 9
Sorry for the confusion, i didnt specify that im using Informix. All the syntax I used is valid in Informix. Given that, Im looking for a design solution to improve performance.
Reply With Quote
  #4 (permalink)  
Old 03-23-09, 13:06
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,407
>i didnt specify that im using Informix.
So exactly why are you posting to an ORACLE forum & not Informix forum?
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #5 (permalink)  
Old 03-23-09, 13:33
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Moved to correct forum.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On