From: | Pierre Couderc <pierre(at)couderc(dot)cc> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Cc: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Re: SQL pour trouver le premier libre? |
Date: | 2006-06-03 09:48:44 |
Message-ID: | 44815AFC.40609@couderc.cc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-fr-generale |
Magnifique.
Merci beaucoup.
Maintenant, je vais essayer de comprendre comment ça marche....
Merci, bon WE
PC
Jean-Paul Argudo a écrit :
> Re (dernier post, promis)
>
>> Mieux, non :-)
>
> Non c'est mieux *après* le café...
>
>
> test2=> select a+1 as id_disponible from nombres except select a from
> nombres order by id_disponible limit 1;
>
> id_disponible
> ---------------
> 4
> (1 ligne)
>
>
> C'est à dire que la condition WHERE ne sert plus à grand chose (dans la
> mesure où a>0 tout le temps) dans mon exemple !
>
>
> test2=> explain select a+1 as id_disponible from nombres except select a
> from nombres order by id_disponible limit 1;
> QUERY PLAN
>
> ------------------------------------------------------------------------------------------
> Limit (cost=333.73..333.78 rows=1 width=4)
> -> SetOp Except (cost=333.73..353.13 rows=388 width=4)
> -> Sort (cost=333.73..343.43 rows=3880 width=4)
> Sort Key: id_disponible
> -> Append (cost=0.00..102.45 rows=3880 width=4)
> -> Subquery Scan "*SELECT* 1" (cost=0.00..53.65
> rows=1940 width=4)
> -> Seq Scan on nombres (cost=0.00..34.25
> rows=1940 width=4)
> -> Subquery Scan "*SELECT* 2" (cost=0.00..48.80
> rows=1940 width=4)
> -> Seq Scan on nombres (cost=0.00..29.40
> rows=1940 width=4)
> (9 lignes)
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
From | Date | Subject | |
---|---|---|---|
Next Message | Marc Cousin | 2006-06-03 09:49:15 | Re: SQL pour trouver le premier libre? |
Previous Message | Jean-Paul Argudo | 2006-06-03 09:43:09 | Re: SQL pour trouver le premier libre? |