dbTalk Databases Forums  

New index on in use DB ?

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss New index on in use DB ? in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kam
 
Posts: n/a

Default New index on in use DB ? - 10-23-2007 , 11:34 AM







I have an ASA 7 DB that I need to build some new indexes on
for some large tables. The company is open 24x7 so the DB
is never taken down. Can I build the new indexes while the
DB is in use?

Reply With Quote
  #2  
Old   
Dmitri
 
Posts: n/a

Default Re: New index on in use DB ? - 10-23-2007 , 11:47 AM






<kam> wrote:

Quote:
I have an ASA 7 DB that I need to build some new indexes on
for some large tables. The company is open 24x7 so the DB
is never taken down. Can I build the new indexes while the
DB is in use?
Unlikely - you need an exclusive access to the table being indexed.

Dmitri.




Reply With Quote
  #3  
Old   
Breck Carter [Team iAnywhere]
 
Posts: n/a

Default Re: New index on in use DB ? - 10-23-2007 , 12:28 PM



As Dmitri indicated, a connection trying to do a CREATE INDEX will be
blocked by any connection that has even done a SELECT, let alone an
INSERT/UPDATE/DELETE, without doing a COMMIT or ROLLBACK.

At some point, you're going to have to make sure all other connections
have either (a) been dropped, or (b) done a COMMIT/ROLLBACK.

One way to do (a) is to stop dbsrv7 and bring up dbeng7 which won't
allow network connections, do your thing, and then switch back.

You can also do (a) with the programmer's friend,
p_drop_other_connections; just do this search in google.groups.com for
the code AND a description of how to use it to keep control for a
while:

p_drop_other_connections group:*.sqlanywhere.*

If you are optimistic, and if you think that eventually (b) will
happen sometime in the middle of the night, you can just start a
CREATE INDEX in a dbisql session, let it get blocked, and let it sit
there until it can run. Other than possibly taking a long time once it
does start to run (and blocking other users from touching the table at
all while it runs), the CREATE INDEX statement won't damage anything,
even if it fails.

(at this point, Glenn Paulley is going to yell at me for advocating
optimism

Breck

On 23 Oct 2007 09:34:13 -0700, kam wrote:

Quote:
I have an ASA 7 DB that I need to build some new indexes on
for some large tables. The company is open 24x7 so the DB
is never taken down. Can I build the new indexes while the
DB is in use?
--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book: http://www.risingroad.com/SQL_Anywhe...ers_Guide.html
breck.carter (AT) risingroad (DOT) com


Reply With Quote
  #4  
Old   
Nick Elson
 
Posts: n/a

Default Re: New index on in use DB ? - 10-24-2007 , 10:14 AM



You can create indexes on a running production server
but you will require exclusive access to the table for
the duration of the index creation; which may be
protracted for tables with a large number of rows.

If you can take a table out of use, a LOCK TABLE
statement ahead of the CREATE INDEX can be
used to prevent access.

I don't know if this helps but ....

<kam> wrote

Quote:
I have an ASA 7 DB that I need to build some new indexes on
for some large tables. The company is open 24x7 so the DB
is never taken down. Can I build the new indexes while the
DB is in use?



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.