La version de postgres est la 7.0 sur une Ultra 5 sous solaris 2.6.

> > J'ai bien essayé de faire des index sur la colonne id p.e mais le temps
> > de réponse est toujours aussi long!
> Ainsi:
>    CREATE INDEX sol_f_id_idx ON sol_f(id);  # ceci prend du temps.

c'est exactement comme cela.

> Donc l'index semble avoir un effet, du moins pour ma configuration.

Mais pas dans mon cas! ou alors j'ai fais qqchose de faux. 
Dans l'autre index ou il n'y a que 130752 c'est quasi instantané.

> hum, id étant un integer me semble-t-il, j'aurais fait
>   WHERE id = 130751;
C'est juste je me suis planté dans mon cut&paste

Je viens de faire un
EXPLAIN  SELECT * FROM main_index_f WHERE id='130751';
Index Scan using main_index_f_pkey on main_index_f  (cost=0.00..8.14 rows=10 width=40)

et puis un 

EXPLAIN  SELECT * FROM sol_f WHERE id='130751';
Seq Scan on sol_f  (cost=0.00..77604.64 rows=39087 width=24)

Donc la clairement j'en deduis qu'il n'utilise pas mon index!
et pourtant j'en ai bien fait un

sylex2000=>  CREATE INDEX sol_f_id_idx ON sol_f (id);
CREATE

sylex2000=> \di
         List of relations
       Name        | Type  | Owner  
-------------------+-------+--------
 main_index_d_pkey | index | robert
 main_index_f_pkey | index | robert
 main_index_i_pkey | index | robert
 sol_f_id_idx      | index | robert
(4 rows)

J'avoue ne pas bien comprendre comment il détermine l'index (c'est semble-t-il 
indépendant du nom
"Although you can use any name for the index, it is good practice to use the table and 
column names as part of the index name...") et comment le forcer à l'utiliser. Ou 
alors il y a autre chose!


G.
-- 
                               |  UnixOnNous et Rejoignez le
Gilbert ROBERT                 | "Groupe des Utilisateurs Lémaniques de"
ISSCO, University of Geneva    |     / /    (_)____   __  __ _  __  
40 bd pont d'arve              |    / /    / // __ \ / / / /| |/_/ 
CH-1211 GENEVA 4               |   / /___ / // / / // /_/ /_>  <
Tel: +41/22/705 8686           |  /_____//_//_/ /_//_____/ /_/\_\
http://www.gilbert-robert.com  |      http://www.linux-gull.ch
--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question.

Répondre à