weird behaviour

Поиск
Список
Период
Сортировка
Искать

weird behaviour

От:
matthieuclavier@mageos.com
Дата:
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

Re: weird behaviour

От:
matthieuclavier@mageos.com
Дата:


sorry, i forgot some version number :) 


[mat@biniac ~]$ psql --version
psql (PostgreSQL) 7.1.2
contains readline, history support
Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Portions Copyright (c) 1996 Regents of the University of California
Read the file COPYRIGHT or use the command \copyright to see the
usage and distribution terms.


[mat@biniac ~]$uname -rs
FreeBSD 4.3-RELEASE[mat@biniac ~]$

mat
FAQ