Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Performance > Re: RAID 10 Ben...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 6 Topic 4057 of 4352
Post > Topic >>

Re: RAID 10 Benchmark with different I/O schedulers

by craig_james@[EMAIL PROTECTED] (Craig James) Jun 25, 2008 at 06:52 PM

This seems like a bug to me, but it shows up as a performance problem. 
Since the column being queried is an integer, the second query (see below)
can't possibly match, yet Postgres uses a typecast, forcing a full table
scan for a value that can't possibly be in the table.

The application could intercept these bogus queries, but that requires
building schema-specific and postgres-specific knowledge into the
application (i.e. "What is the maximum legal integer for this column?").

Craig


explain analyze select version_id, parent_id from version where version_id
= 99999;
                                                      QUERY PLAN          
                                           
----------------------------------------------------------------------------------------------------------------------
 Index Scan using version_pkey on version  (cost=0.00..9.89 rows=1
width=8) (actual time=0.054..0.054 rows=0 loops=1)
   Index Cond: (version_id = 99999)
 Total runtime: 0.130 ms
(3 rows)

emol_warehouse_1=> explain analyze select version_id, parent_id from
version where version_id = 999999999999999999999999999;
                                                   QUERY PLAN             
                                     
----------------------------------------------------------------------------------------------------------------
 Seq Scan on version  (cost=0.00..253431.77 rows=48393 width=8) (actual
time=3135.530..3135.530 rows=0 loops=1)
   Filter: ((version_id)::numeric = 999999999999999999999999999::numeric)
 Total runtime: 3135.557 ms
(3 rows)


 \d version
 Table "emol_warehouse_1.version"
   Column   |  Type   | Modifiers 
------------+---------+-----------
 version_id | integer | not null
 parent_id  | integer | not null
 ... more columns
Indexes:
    "version_pkey" PRIMARY KEY, btree (version_id)




-- 
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
 




 6 Posts in Topic:
Re: RAID 10 Benchmark with different I/O schedulers
gsmith@[EMAIL PROTECTED]   2008-05-06 16:21:08 
Re: RAID 10 Benchmark with different I/O schedulers
craig_james@[EMAIL PROTEC  2008-05-06 13:43:54 
Re: RAID 10 Benchmark with different I/O schedulers
laurenz.albe@[EMAIL PROTE  2008-05-07 09:29:05 
Re: RAID 10 Benchmark with different I/O schedulers
craig_james@[EMAIL PROTEC  2008-06-25 18:52:59 
Re: Typecast bug?
tgl@[EMAIL PROTECTED] (T  2008-06-26 01:33:30 
Re: Typecast bug?
craig_james@[EMAIL PROTEC  2008-06-25 23:22:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 14:40:32 CDT 2008.