Bonjour,
Je développe (j'essaie) en ce moment un soft ayant pour but de gérer consultations, insertions, impressions de données contenues dans une base MySQL hébergée sur un serveur NAS. Il reste des choses à faire, comme les vérifications des données saisies, les tests d'erreur SQL, etc, mais tout est déjà fonctionnel, l'outil est opérationnel. Mon gros problème qui ne fait d'ailleurs que grossir, c'est la lenteur hallucinante du soft à afficher des données de la base. Plus la base grossit, pire c'est evidemment, mais quand même, à 15 enregistrements sur chaque table c'est déjà la misère

Voici la BDD :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*==============================================================*/
/* Nom de SGBD :  MySQL 5.0                                     */
/* Date de création :  20/05/2010 09:49:28                      */
/*==============================================================*/
 
 
drop table if exists BATEAU;
 
drop table if exists CLES;
 
drop table if exists CLIENT;
 
drop table if exists EMPLACEMENT;
 
drop table if exists INTERVENTION;
 
drop table if exists MECANICIEN;
 
drop table if exists MOTEUR;
 
drop table if exists TRANSMISSION;
 
/*==============================================================*/
/* Table : BATEAU                                               */
/*==============================================================*/
create table BATEAU
(
   CODE_BATEAU          smallint not null auto_increment,
   CODE_CLIENT          int not null,
   CODE_EMPLACEMENT     int not null,
   CODE_MOTEUR          int not null,
   CODE_TRANSMI         int not null,
   NOM_BATEAU           char(35),
   TYPE_BATEAU          char(35),
   COMMENTAIRES         varchar(5000),
   primary key (CODE_BATEAU)
);
 
/*==============================================================*/
/* Table : CLES                                                 */
/*==============================================================*/
create table CLES
(
   CODE_CLES            int not null auto_increment,
   LIBELLE_CLES         char(25),
   primary key (CODE_CLES)
);
 
/*==============================================================*/
/* Table : CLIENT                                               */
/*==============================================================*/
create table CLIENT
(
   CODE_CLIENT          int not null auto_increment,
   NOM_CLIENT           char(25),
   PRENOM_CLIENT        char(25),
   FIXE_CLIENT          char(10),
   ADRESSE_RUE_CLIENT   char(150),
   ADRESSE_CP_CLIENT    char(5),
   ADRESSE_VILLE_CLIENT char(30),
   PORTABLE_CLIENT      char(10),
   FAX_CLIENT           char(10),
   MAIL_CLIENT          varchar(35),
   primary key (CODE_CLIENT)
);
 
/*==============================================================*/
/* Table : EMPLACEMENT                                          */
/*==============================================================*/
create table EMPLACEMENT
(
   CODE_EMPLACEMENT     int not null auto_increment,
   NOM_EMPLACEMENT      char(25),
   PONTON               char(15),
   primary key (CODE_EMPLACEMENT)
);
 
/*==============================================================*/
/* Table : INTERVENTION                                         */
/*==============================================================*/
create table INTERVENTION
(
   NUMERO_INTERVENTION  int not null auto_increment,
   CODE_MECANICIEN      int not null,
   CODE_CLES            int not null,
   CODE_BATEAU          smallint not null,
   DATE_INTERVENTION    varchar(35),
   HEURE_INTERVENTION   varchar(30),
   TRAVAIL_A_FAIRE      varchar(25000),
   TRAVAIL_EFFECTUE     varchar(25000),
   DUREE_INTERVENTION   int,
   HEURE_MOTEUR         int,
   primary key (NUMERO_INTERVENTION)
);
 
/*==============================================================*/
/* Table : MECANICIEN                                           */
/*==============================================================*/
create table MECANICIEN
(
   CODE_MECANICIEN      int not null auto_increment,
   NOM_MECANICIEN       char(20),
   PRENOM_MECANICIEN    char(25),
   primary key (CODE_MECANICIEN)
);
 
/*==============================================================*/
/* Table : MOTEUR                                               */
/*==============================================================*/
create table MOTEUR
(
   CODE_MOTEUR          int not null auto_increment,
   MARQUE_MOTEUR        char(20),
   TYPE_MOTEUR          char(20),
   primary key (CODE_MOTEUR)
);
 
/*==============================================================*/
/* Table : TRANSMISSION                                         */
/*==============================================================*/
create table TRANSMISSION
(
   CODE_TRANSMI         int not null auto_increment,
   MARQUE_TRANSMI       varchar(25),
   MODELE_TRANSMI       varchar(15),
   TYPE_TRANSMI         char(15),
   primary key (CODE_TRANSMI)
);
 
alter table BATEAU add constraint FK_APPARTENIR foreign key (CODE_CLIENT)
      references CLIENT (CODE_CLIENT) on delete restrict on update restrict;
 
alter table BATEAU add constraint FK_ASSOCIATION_7 foreign key (CODE_TRANSMI)
      references TRANSMISSION (CODE_TRANSMI) on delete restrict on update restrict;
 
alter table BATEAU add constraint FK_CORRESPONDRE foreign key (CODE_MOTEUR)
      references MOTEUR (CODE_MOTEUR) on delete restrict on update restrict;
 
alter table BATEAU add constraint FK_MOUILLER foreign key (CODE_EMPLACEMENT)
      references EMPLACEMENT (CODE_EMPLACEMENT) on delete restrict on update restrict;
 
alter table INTERVENTION add constraint FK_CORRESPONDRE_2 foreign key (CODE_CLES)
      references CLES (CODE_CLES) on delete restrict on update restrict;
 
alter table INTERVENTION add constraint FK_INTERVENIR foreign key (CODE_MECANICIEN)
      references MECANICIEN (CODE_MECANICIEN) on delete restrict on update restrict;
 
alter table INTERVENTION add constraint FK_SUBIR foreign key (CODE_BATEAU)
      references BATEAU (CODE_BATEAU) on delete restrict on update restrict;
Exemple : cette fenêtre
est une des pires.

Lorsqu'on clique sur le bouton "réinitialise",
les 3 listboxs sont reremplies de la même manière qu'au chargement de la fenêtre (qui prend également une éternité ),
et l'AutoCompleteCustomSource de certaines TextBoxs se reremplient également.
Voici le code du clic sur le bouton "Réinitialiser":
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Private Sub B_Réinit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B_Réinit.Click
        req = "SELECT CONCAT( cc.NUMERO_INTERVENTION,'  ------  sur ', NOM_BATEAU, ' ( ', TYPE_BATEAU,' ),  Le  ',DATE_INTERVENTION,'  par  ',PRENOM_MECANICIEN) FROM BATEAU ba, INTERVENTION cc, MECANICIEN me, CLIENT cl  WHERE cc.CODE_BATEAU = ba.CODE_BATEAU AND me.CODE_MECANICIEN=cc.CODE_MECANICIEN AND ba.CODE_CLIENT=cl.CODE_CLIENT"
        LB_Clients.Items.Clear()
        LB_Intervention.Items.Clear()
 
        T_Rech_Bateau.Text = ""
        T_Rech_Bateau.Text = ""
        CB_Jour.SelectedItem = Nothing
        CB_Mois.SelectedItem = Nothing
        CB_Mecano.SelectedItem = Nothing
 
 
        Dim cnxclients As MySqlConnection
        cnxclients = New MySqlConnection("Database=BDDLELU;Data Source=192.168.1.100;User Id=variK;Password=""")
        cnxclients.Open()
        Dim cmdclients As MySqlCommand
        cmdclients = cnxclients.CreateCommand()
        cmdclients.CommandText = "select NOM_CLIENT, PRENOM_CLIENT, FIXE_CLIENT, PORTABLE_CLIENT from CLIENT"
        Dim drclients As MySqlDataReader
        drclients = cmdclients.ExecuteReader()
        Do While drclients.Read()
            LB_Clients.Items.Add(drclients.GetString(0) & " " & drclients.GetString(1))
            T_Rech_Client.AutoCompleteCustomSource.Add(drclients.GetString(0) & " " & drclients.GetString(1))
            T_Rech_Client.AutoCompleteCustomSource.Add(drclients.GetString(2))
            T_Rech_Client.AutoCompleteCustomSource.Add(drclients.GetString(3))
        Loop
        cnxclients.Close()
 
        LB_Bateau.Items.Clear()
 
        Dim cnxbat As MySqlConnection
        cnxbat = New MySqlConnection("Database=BDDLELU;Data Source=192.168.1.100;User Id=variK;Password=""")
        cnxbat.Open()
        Dim cmdbat As MySqlCommand
        cmdbat = cnxbat.CreateCommand()
        cmdbat.CommandText = "select NOM_BATEAU from BATEAU"
        Dim drbat As MySqlDataReader
        drbat = cmdbat.ExecuteReader()
        Do While drbat.Read()
            LB_Bateau.Items.Add(drbat.GetString(0))
        Loop
        cnxbat.Close()
 
        Dim cnxbateau As MySqlConnection
        cnxbateau = New MySqlConnection("Database=BDDLELU;Data Source=192.168.1.100;User Id=variK;Password=""")
        cnxbateau.Open()
        Dim cmdbateau As MySqlCommand
        cmdbateau = cnxbateau.CreateCommand()
        cmdbateau.CommandText = "select NOM_BATEAU, TYPE_BATEAU, MARQUE_MOTEUR, TYPE_MOTEUR FROM BATEAU, MOTEUR"
        Dim drbateau As MySqlDataReader
        drbateau = cmdbateau.ExecuteReader()
        Do While drbateau.Read()
            T_Rech_Bateau.AutoCompleteCustomSource.Add(drbateau.GetString(0))
            T_Rech_Bateau.AutoCompleteCustomSource.Add(drbateau.GetString(1))
            T_Rech_Bateau.AutoCompleteCustomSource.Add(drbateau.GetString(3) & " " & drbateau.GetString(2))
        Loop
        cnxbateau.Close()
 
 
        Dim cnxinter As MySqlConnection
        cnxinter = New MySqlConnection("Database=BDDLELU;Data Source=192.168.1.100;User Id=variK;Password=""")
        cnxinter.Open()
        Dim cmdinter As MySqlCommand
        cmdinter = cnxinter.CreateCommand()
        cmdinter.CommandText = req
        Dim drinter As MySqlDataReader
        drinter = cmdinter.ExecuteReader()
        Do While drinter.Read()
            LB_Intervention.Items.Add(drinter.GetString(0))
        Loop
        cnxinter.Close()
 
    End Sub
Je débute en Vb.net, je me doute donc que le code n'est pas tip top, mais est-il normal que ce code lancé par le clic sur "réinitialiser" mette environ
10 secondes à s'effectuer ? La fenêtre clignote de partout et pendant quelques secondes le programme ne répond même plus.

Encore une fois, il y a à peine une 15aine d'enregistrements sur ces tables.
Et ce genre de tracas est rencontré dans pas mal d'autres endroits du soft.

Dernière précision : croyant que cela venait du serveur NAS, j'ai testé le soft en installant la BDD en local sur ma machine (tout à fait respectable), même résultat.

J'espère que quelqu'un pourra m'aider.

Merci de m'avoir lu, et d'avance merci beaucoup pour votre aide.
Cdt,
varik