Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Reindex Database


graphicore

Recommended Posts

still, it's often clever to recreate indexes after a while!

 

I especially like to recreate the p2c table index....

 

and then of course run on all tables check, analize and optimize

I believe there is also a contrib for that

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

What exactly are you trying to do?

 

A database index keeps itself updated no matter how many deletes, inserts, and updates you do. That's the whole point of it.

 

For example:

 

I created 10 new products....

in the database the ID's are: 1..2..3..4..5..6..7..8..9..10

 

Later I removed item ID#2 and added a new product...

Now the databae is 1..3..4..5..6..7..8..9..10..11

 

I want to reindex it so it shows as 1..2..3..4..5..6..7..8..9..10 again.

 

This is a small example... I have 1000's of items on my database and I refer/point to the database ID's on a modified OSC file.

Link to comment
Share on other sites

For example:

 

I created 10 new products....

in the database the ID's are: 1..2..3..4..5..6..7..8..9..10

 

Later I removed item ID#2 and added a new product...

Now the databae is 1..3..4..5..6..7..8..9..10..11

 

I want to reindex it so it shows as 1..2..3..4..5..6..7..8..9..10 again.

 

This is a small example... I have 1000's of items on my database and I refer/point to the database ID's on a modified OSC file.

 

 

Aha.

 

The answer is - it's not worth the effort. Once you update that primary key, you must update it in all other tables that reference that record using that id. It's HIGHLY likely there's a better way to do whatever it is you're trying to do.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

you want to change all ids? now that's a fun project. Add a new column to all tables that have the products_id column. Grab the first table (say table products) and fill up the new column in a loop by a php script. Then update all tables from this new column and the products_id. Drop the old ID column, rename the new one, set autoinsert and your index new and you're set. Really worth it? As you can see, I had to do it before ;-)

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

you want to change all ids? now that's a fun project. Add a new column to all tables that have the products_id column. Grab the first table (say table products) and fill up the new column in a loop by a php script. Then update all tables from this new column and the products_id. Drop the old ID column, rename the new one, set autoinsert and your index new and you're set. Really worth it? As you can see, I had to do it before ;-)

 

Thanks Monika.... I figure that was a big task and maybe not worthy.... Maybe you can help me then modify a .php file which I just refer on a new post. Here: http://www.oscommerce.com/forums/index.php?showtopic=244797 (I know it's simple... but I do not know PHP :P)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...