hi,

i'm notice a weird behaviour while running a query on the same table,
the query take a long time to be executed when this table is empty ,
and when this table isn't empty, it take about 1/2 second ....
the two tables are freshly vacuumed ...

here the same tables, one is empty, not the other :

     Table "classement_jeu"
 Attribute |   Type   | Modifier 
-----------+----------+----------
 semaine   | smallint | 
 annee     | integer  | 
 id_turf   | integer  | 
 points    | integer  | 
 tag       | smallint | 

    Table "classement_jeumat"
 Attribute |   Type   | Modifier 
-----------+----------+----------
 semaine   | smallint | 
 annee     | integer  | 
 id_turf   | integer  | 
 points    | integer  | 
 tag       | smallint | 


psql -c "select count(*) from classement_jeu"
 count 
-------
  21318
(1 row)

psql "select count(*) from classement_jeumat"
 count 
-------
 0
(1 row)


now the query i want to run :

SELECT id_turf 
FROM classement_jeumat 
WHERE semaine = 35 
AND annee = 2001 
AND id_turf IN (5247,5425, ....)

the IN clause contain about 600 entries ....


run the query on table classement_jeumat (empty table)

time psql < laquery 
 id_turf 
---------
(0 rows)


real    1m18.308s
user    0m0.000s
sys     0m0.015s


run the query on table classement_jeu (not empty table)

time psql < laquery 
 id_turf 
---------
[... snip results ... ]
(592 rows)


real    0m0.472s
user    0m0.009s
sys     0m0.014s



somebody understand what happened ?

it's not really important because i will not work on an empty
table ... but i'm surprised ...


thanxs

mat

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to