Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 78AA86330BE for ; Tue, 16 Feb 2010 06:26:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 88000-06 for ; Tue, 16 Feb 2010 10:26:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp19.orange.fr (smtp19.orange.fr [80.12.242.17]) by mail.postgresql.org (Postfix) with ESMTP id 532BB632FDA for ; Tue, 16 Feb 2010 06:26:39 -0400 (AST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1909.orange.fr (SMTP Server) with ESMTP id EA20E1C00156 for ; Tue, 16 Feb 2010 11:26:37 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1909.orange.fr (SMTP Server) with ESMTP id D837D1C00573 for ; Tue, 16 Feb 2010 11:26:37 +0100 (CET) Received: from [192.168.10.15] (ARennes-257-1-110-118.w86-210.abo.wanadoo.fr [86.210.21.118]) by mwinf1909.orange.fr (SMTP Server) with ESMTP id 57AF61C003B0 for ; Tue, 16 Feb 2010 11:26:37 +0100 (CET) X-ME-UUID: 20100216102637359.57AF61C003B0@mwinf1909.orange.fr Message-ID: <4B7A72DC.4020201@boozter.com> Date: Tue, 16 Feb 2010 11:26:36 +0100 From: lionel duboeuf User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Almost infinite query -> Different Query Plan when changing where clause value References: <4B790387020000250002F2CF@gw.wicourts.gov> In-Reply-To: <4B790387020000250002F2CF@gw.wicourts.gov> Content-Type: multipart/mixed; boundary="------------090607010609020106080302" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201002/251 X-Sequence-Number: 37672 This is a multi-part message in MIME format. --------------090607010609020106080302 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Here is my log analysis: Due to a database recovery task it appears that: I stopped postgresql I started postgresql (and as default autovacuum daemon) I restored the databases (need to restore 4 databases) It seems that after database 1 have been restored, autovacumm started on it and has been stopped while restoring database 2. @see log as attached Here is backup/restore commands i use: /usr/bin/pg_dump -i -h localhost -U postgres -F c -b -f ... x 4 times sudo -u postgres pg_restore -d 'database1' x 4 times Does this kind of error can lead to the query problem ? If so, what would you suggest me to do to avoid the problem again ?. Thanks Lionel Kevin Grittner a écrit : > lionel duboeuf wrote: > >> Kevin Grittner a écrit : >> > > >>> I just reread your original email, and I'm not sure I understand >>> what you meant regarding VACUUM ANALYZE. If you run that right >>> beforehand, do you still get the slow plan for user 10? >>> > > >> I confirm by executing manual "VACUUM ANALYZE" that the problem is >> solved. But what i don't understand is that i would expect >> autovacuum to do the job. >> > > I think this is the crux of the issue. Boosting the > default_statistics_target or the statistics target for specific > columns might help, reducing autovacuum_analyze_scale_factor might > help, but I can't help wondering whether you inserted a large number > of rows for user 10 and then ran the query to select user 10 before > autovacuum had time to complete. Does that seem possible? > > -Kevin > > --------------090607010609020106080302 Content-Type: text/plain; name="log_postgres" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="log_postgres" 2010-02-10 12:24:25 CET LOG: paquet de démarrage incomplet 2010-02-10 12:24:25 CET LOG: a reçu une demande d'arrêt rapide 2010-02-10 12:24:25 CET LOG: annulation des transactions actives 2010-02-10 12:24:25 CET LOG: arrêt du processus autovacuum 2010-02-10 12:24:25 CET LOG: arrêt en cours 2010-02-10 12:24:25 CET LOG: le système de base de données est arrêté 2010-02-10 12:24:26 CET LOG: n'a pas pu charger le fichier du certificat racine « root.crt » : aucun code d'erreur SSL rapporté 2010-02-10 12:24:26 CET DÉTAIL: Ne vérifiera pas les certificats du client. 2010-02-10 12:24:26 CET LOG: le système de bases de données a été arrêté à 2010-02-10 12:24:25 CET 2010-02-10 12:24:26 CET LOG: le système de bases de données est prêt pour accepter les connexions 2010-02-10 12:24:26 CET LOG: lancement du processus autovacuum 2010-02-10 12:24:26 CET LOG: paquet de démarrage incomplet [checkpoints Warning] 2010-02-10 12:24:34 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 3 secondes) 2010-02-10 12:24:34 CET ASTUCE : Considèrez l'augmentation du paramètre « checkpoint_segments ». 2010-02-10 12:24:39 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 5 secondes) 2010-02-10 12:24:39 CET ASTUCE : Considèrez l'augmentation du paramètre « checkpoint_segments ». 2010-02-10 12:24:43 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 4 secondes) 2010-02-10 12:24:43 CET ASTUCE : Considèrez l'augmentation du paramètre « checkpoint_segments ». 2010-02-10 12:24:47 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 4 secondes) 2010-02-10 12:24:47 CET ASTUCE : Considèrez l'augmentation du paramètre « checkpoint_segments ». 2010-02-10 12:24:52 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 5 secondes) 2010-02-10 12:24:52 CET ASTUCE : Considèrez l'augmentation du paramètre « checkpoint_segments ». 2010-02-10 12:24:56 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 4 secondes) 2010-02-10 12:24:56 CET ASTUCE : Considèrez l'augmentation du paramètre « checkpoint_segments ». 2010-02-10 12:25:01 CET LOG: les points de vérification (checkpoints) arrivent trop fréquemment (toutes les 5 secondes) [database 1 restore] 2010-02-10 12:25:03 CET INFO: ALTER TABLE / ADD PRIMARY KEY créera un index implicite « pk_block » pour la table « block » ... ... 2010-02-10 12:25:13 CET INFO: ALTER TABLE / ADD PRIMARY KEY créera un index implicite « pk_user_panel » pour la table « user_panel » [here is autovacuum error] 2010-02-10 12:25:44 CET ERREUR: annulation de la tâche d'autovacuum 2010-02-10 12:25:44 CET CONTEXTE : ANALYZE automatique de la table « boozterbase.public.translation » 2010-02-10 12:25:45 CET ERREUR: annulation de la tâche d'autovacuum 2010-02-10 12:25:45 CET CONTEXTE : ANALYZE automatique de la table « boozterbase.public.label » 2010-02-10 12:25:48 CET ERREUR: annulation de la tâche d'autovacuum 2010-02-10 12:25:48 CET CONTEXTE : ANALYZE automatique de la table « boozterbase.public.link » [end autovacuum error] [database 2 restore] 2010-02-10 12:25:53 CET INFO: ALTER TABLE / ADD PRIMARY KEY créera un index implicite « Coordinate_pkey » pour la table « coordinate » 2010-02-10 12:25:53 CET INFO: ALTER TABLE / ADD PRIMARY KEY créera un index implicite « compte_mail_pkey » pour la table « mail_account » 2010-02-10 12:25:53 CET INFO: ALTER TABLE / ADD UNIQUE créera un index implicite « person_uid_uc » pour la table « person » ... [nothing to see here] --------------090607010609020106080302--