Clean up the DB?! // Datenbank bereinigen?!
Clean up the DB?! // Datenbank bereinigen?!
In my Database are tons of articles and cats which dont exist any longer, I don't want to clean up by hand. It's too complex.
Is there anything which helps me to clean up my Database with the "240 articles" (in use are only ~100)?
/////////////
Meine Datenbank quillt langsam etwas über...längst nicht mehr vorhandene Artikel sind dort noch wiederzufinden...gibt es etwas um das ganz etwas zu bereinigen?
greetz Rahner
Is there anything which helps me to clean up my Database with the "240 articles" (in use are only ~100)?
/////////////
Meine Datenbank quillt langsam etwas über...längst nicht mehr vorhandene Artikel sind dort noch wiederzufinden...gibt es etwas um das ganz etwas zu bereinigen?
greetz Rahner
Hi,
there are table columns like trash or deleted. If they are filled with e.g. 999 this row is signed as deleted.
Have a look:
http://faq.phpwcms-docu.de/category8.html (german)
http://faq.phpwcms-docu.de/category9.html (english)
Knut
there are table columns like trash or deleted. If they are filled with e.g. 999 this row is signed as deleted.
Have a look:
http://faq.phpwcms-docu.de/category8.html (german)
http://faq.phpwcms-docu.de/category9.html (english)
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Dort finde ich leider nichts zu meinem Problem...oder übersehe ich da was?flip-flop wrote:Hi,
there are table columns like trash or deleted. If they are filled with e.g. 999 this row is signed as deleted.
Have a look:
http://faq.phpwcms-docu.de/category8.html (german)
http://faq.phpwcms-docu.de/category9.html (english)
Knut
Das sind hinweise auf die Verarbeitung der Daten.
In der DB suchst du die tabelle die bearbetet werden soll. -> Ansicht -> und nun die Spalte Trash oder delet (999 oder 99999) oder so. Das sind die Zeilen, die gelöscht werden könen, da sie als GELÖSC'HT markiert sind.
In der DB suchst du die tabelle die bearbetet werden soll. -> Ansicht -> und nun die Spalte Trash oder delet (999 oder 99999) oder so. Das sind die Zeilen, die gelöscht werden könen, da sie als GELÖSC'HT markiert sind.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
- Oliver Georgi
- Site Admin
- Posts: 9914
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
In aller Regel ist der Wert nicht 999 sondern NUR 9.
Hier die passenden Queries dazu:
Üblicherweise sehe ich aber keinen Vorteil darin Daten final aus dem System zu löschen - nicht solange wir über lediglich 100 Datensätze reden. Bei 100.000 könnten wir noch mal drüber reden.
Oliver
Hier die passenden Queries dazu:
Code: Select all
DELETE FROM phpwcms_article WHERE article_deleted=9;
DELETE FROM phpwcms_articlecontent WHERE acontent_trash=9;
Oliver
- Oliver Georgi
- Site Admin
- Posts: 9914
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Hi
@OliverG
just a suggestion - make Database-Table(s) like phpwcms_article_trash and etc. move the deleted Articles etc. to this Tables - so the 'Original' Tables will keep clean and if a User is shure to remove the Trash Files it is a easy 'drop Table'
and with a little bit more Code a 'Recover deleted Structures/Article will be easy.
I know that this is not realy nessercy - but will be a nice Feature.
@OliverG
just a suggestion - make Database-Table(s) like phpwcms_article_trash and etc. move the deleted Articles etc. to this Tables - so the 'Original' Tables will keep clean and if a User is shure to remove the Trash Files it is a easy 'drop Table'
and with a little bit more Code a 'Recover deleted Structures/Article will be easy.
I know that this is not realy nessercy - but will be a nice Feature.
- Oliver Georgi
- Site Admin
- Posts: 9914
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Pico's suggestion is good and from my point of view it make sense.
From view of a database there is a big difference between 100 or 100.000 rows in a table. But this depends how you are working with such a table. Every sql statement will parsed and optimized. If the optimizer recognize that a table contains an index which can be used for the sql statement then the index will used. But in case that there is no adequate index then the optimizer will initiate a full table scan. This means he will load every row from the table. Pending on the memory which is assigned and the size of the tables this is something which can not be handled in memory, this means that we produce I/O and this is the worst and slowest case. For this reason it make definitely sense to ensure that in a production environment is no unnecessary trash or something else.
But I fully aggree with you about the issue that often important information is gone by just one click and that this is something which occurs sometimes and of course just on a sunny Friday
However on the other hand we must ensure that the response time of our server is as short as possible, especially durring peaks. If I can decided which is more important, then I would do everything to improve my performance and of course I will ensure that we have at least a daily backup of the production environment
Currently my biggest phpWCMS installation contains 970 articles (270 of them are in trash) and 1676 contentparts (375 of them in trash). Yes it works, but when I will reach the limits of my little server, when my visitors will boring because they are waiting for a requested page more then x seconds? We will see
Just my two cents worth
Br
Wolfgang
From view of a database there is a big difference between 100 or 100.000 rows in a table. But this depends how you are working with such a table. Every sql statement will parsed and optimized. If the optimizer recognize that a table contains an index which can be used for the sql statement then the index will used. But in case that there is no adequate index then the optimizer will initiate a full table scan. This means he will load every row from the table. Pending on the memory which is assigned and the size of the tables this is something which can not be handled in memory, this means that we produce I/O and this is the worst and slowest case. For this reason it make definitely sense to ensure that in a production environment is no unnecessary trash or something else.
But I fully aggree with you about the issue that often important information is gone by just one click and that this is something which occurs sometimes and of course just on a sunny Friday

However on the other hand we must ensure that the response time of our server is as short as possible, especially durring peaks. If I can decided which is more important, then I would do everything to improve my performance and of course I will ensure that we have at least a daily backup of the production environment

Currently my biggest phpWCMS installation contains 970 articles (270 of them are in trash) and 1676 contentparts (375 of them in trash). Yes it works, but when I will reach the limits of my little server, when my visitors will boring because they are waiting for a requested page more then x seconds? We will see

Just my two cents worth
Br
Wolfgang
- Oliver Georgi
- Site Admin
- Posts: 9914
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
I know this argument is coming. But really: makes no "real" sense. And I have many other things to do. And these are more important in my eyes. Before implementing this it's better to implement an archiving solution.
If you think you have tons of "maked as deleted" stuff in your db remove it yourself. Optimizing the index might help too.
Oliver
If you think you have tons of "maked as deleted" stuff in your db remove it yourself. Optimizing the index might help too.
Oliver