Skip site navigation (1) Skip section navigation (2)

Re: PostgreSQL does CAST implicitely between int and adomain derived from int

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-performance(at)postgresql(dot)org>, Jean-Michel Pouré <jm(at)poure(dot)com>
Subject: Re: PostgreSQL does CAST implicitely between int and adomain derived from int
Date: 2009-08-27 14:16:17
Message-ID: 4A964EE1020000250002A3E8@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-performance
>Jean-Michel Pouré<jm(at)poure(dot)com> wrote: 
> Does not show any result because of ROLLBACK;
 
Then you need to use a better tool to run it.  For example, in psql:
 
test=# create table t2 (c1 int not null);
CREATE TABLE
test=# insert into t2 select * from generate_series(1,10000);
INSERT 0 10000
test=# create unique index t2_c1 on t2 (c1);
CREATE INDEX
test=# explain analyze select count(*) from t2 where c1 between 200 and
400;
                                                      QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=47.77..47.78 rows=1 width=0) (actual
time=0.668..0.669 rows=1 loops=1)
   ->  Bitmap Heap Scan on t2  (cost=4.76..47.64 rows=50 width=0)
(actual time=0.091..0.380 rows=201 loops=1)
         Recheck Cond: ((c1 >= 200) AND (c1 <= 400))
         ->  Bitmap Index Scan on t2_c1  (cost=0.00..4.75 rows=50
width=0) (actual time=0.080..0.080 rows=201 loops=1)
               Index Cond: ((c1 >= 200) AND (c1 <= 400))
 Total runtime: 0.722 ms
(6 rows)

test=# begin transaction;
BEGIN
test=# drop index t2_c1;
DROP INDEX
test=# explain analyze select count(*) from t2 where c1 between 200 and
400;
                                               QUERY PLAN
--------------------------------------------------------------------------------------------------------
 Aggregate  (cost=190.50..190.51 rows=1 width=0) (actual
time=3.324..3.325 rows=1 loops=1)
   ->  Seq Scan on t2  (cost=0.00..190.00 rows=200 width=0) (actual
time=0.053..3.036 rows=201 loops=1)
         Filter: ((c1 >= 200) AND (c1 <= 400))
 Total runtime: 3.366 ms
(4 rows)

test=# rollback transaction;
ROLLBACK
 
-Kevin

In response to

Responses

pgsql-performance by date

Next:From: Jean-Michel PouréDate: 2009-08-27 14:37:42
Subject: Re: PostgreSQL does CAST implicitely between int and adomain derived from int
Previous:From: Jean-Michel PouréDate: 2009-08-27 14:14:39
Subject: Re: PostgreSQL does CAST implicitely between int and adomain derived from int

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group