![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table with an integer column with about 10M rows in it. This column has an index (btree). When I try to select a row using this column with an integer, e.g. select * from table where id=4, it always uses the index. However, if I select try to select a row using this column with a decimal, e.g. select * from table where id=4.343, it skips the index entirely and does a sequential scan of the table. I am using v7.4.2 on Freebsd 4.9. |
#3
| |||
| |||
|
|
=20 I have a table with an integer column with about 10M rows in it. =20 This column has an index (btree). =20 When I try to select a row using this column with an integer, e.g.=20 select * from table where id=3D4, it always uses the index. However, if= =20 I select try to select a row using this column with a decimal, e.g.=20 select * from table where id=3D4.343, it skips the index entirely and=20 does a sequential scan of the table. =20 I am using v7.4.2 on Freebsd 4.9. |
#4
| |||
| |||
|
|
Yes, I thought I had done that, but now that I figured out what was going on, I did it for all cases. So it is no longer occurring for me, but it still seems like a bug in PostgreSQL. I would expect it to throw an error immediately, instead of scanning the table for a value of a different type. |
#5
| |||
| |||
|
|
Presumably, but that is not what I was doing. |
#6
| |||
| |||
|
|
I would expect if I did intcol = 4.35 or intcol = 'abc', it would throw a type mismatch error. |
#7
| |||
| |||
|
|
It's possible that we could do something more intelligent than the current behavior for that case but I can't come up with a particularly good choice that wouldn't have bad effects elsewhere. |
#8
| |||
| |||
|
|
Presumably, but that is not what I was doing. |
#9
| |||
| |||
|
|
Yes, I thought I had done that, but now that I figured out what was going on, I did it for all cases. So it is no longer occurring for me, but it still seems like a bug in PostgreSQL. I would expect it to throw an error immediately, instead of scanning the table for a value of a different type. |
#10
| |||
| |||
|
|
Presumably, but that is not what I was doing. I was taking a number from a user, which was supposed to be divisible by an integer. Sometimes the user left off the last digit when typing in the number or otherwise typed it in wrong, rendering the input not divisible by that number. So it was looking for something like 4.345. Gabriel _________________ Gabriel Weinberg yegg (AT) alum (DOT) mit.edu -----Original Message----- From: Stephan Szabo [mailto:sszabo (AT) megazone (DOT) bigpanda.com] Sent: Wednesday, April 07, 2004 11:35 AM To: Gabriel Weinberg Cc: 'Bruno Wolff III'; pgsql-bugs (AT) postgresql (DOT) org Subject: Re: [BUGS] Sequential Scan Index Bug On Wed, 7 Apr 2004, Gabriel Weinberg wrote: Yes, I thought I had done that, but now that I figured out what was going on, I did it for all cases. So it is no longer occurring for me, but it still seems like a bug in PostgreSQL. I would expect it to throw an error immediately, instead of scanning the table for a value of a different type. But what if you said id = 4.0? Would you want it to find the id=4 row? ---------------------------(end of broadcast)--------------------------- TIP 3: 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 clean |
![]() |
| Thread Tools | |
| Display Modes | |
| |