[
https://issues.apache.org/jira/browse/CLOUDSTACK-9340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15262753#comment-15262753
]
ASF GitHub Bot commented on CLOUDSTACK-9340:
--------------------------------------------
Github user nvazquez commented on the pull request:
https://github.com/apache/cloudstack/pull/1466#issuecomment-215529568
@rhtyd @rafaelweingartner I could discover the problem by deleting `cloud`
and `cloud_usage` database, then `cloudstack-databases-setup` to create them
blank and restarting CS to create schemas. Error was whis:
````
2016-04-27 08:35:19,850 ERROR [utils.db.ScriptRunner] (main:null) Error
executing: ALTER TABLE `cloud`.`remote_access_vpn` DROP INDEX `id`
2016-04-27 08:35:19,851 ERROR [utils.db.ScriptRunner] (main:null)
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect table
definition; there can be only one auto column and it must be defined as a key
````
That shouldn't be a problem because in `schema-410to420-cleanup.sql` it was:
````
ALTER TABLE `cloud`.`remote_access_vpn` DROP primary key;
ALTER TABLE `cloud`.`remote_access_vpn` ADD primary key (`id`);
````
However, it was noticed that `schemaXXXtoYYY-cleanup.sql` files hadn't been
executed before the failure, so it was decided to move some sentences from
`schema-481to490.sql` to `schema-481to490-cleanup.sql` so they can be executed
after all `schemaXXXtoYYY.sql` files, it succeeded.
> General DB Optimization
> -----------------------
>
> Key: CLOUDSTACK-9340
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9340
> Project: CloudStack
> Issue Type: Improvement
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Affects Versions: 4.9.0
> Reporter: Nicolas Vazquez
> Labels: database
> Fix For: 4.9.0
>
>
> h2. General DB Optimization
> In some production environments there were being experimented delays in most
> of the jobs. A search for DB optimization was taken and some deficiencies
> were discovered, we can group them in 4 groups:
> * Incorrect PRIMARY key
> * Duplicate PRIMARY KEY
> * Missing indexes (Add indexes to avoid full table scans)
> * Some views query (Change view to improve account retrieval speed)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)