| | |
Index with int8 does not work without single quotes !?!? (must read)
Please support our Database Design advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2004
Posts: 1
Reputation:
Solved Threads: 0
I am a programmer for PriceComparison.com.
And I have just solved something quite remarkable and hard to solve. For anyone who has any index using an int8 / bigint field.
You should take time to read this.
The problem start when we noticed that any query with that int8 field is always slow. Finally we did an 'explain' of the query.
The server never even cared of using the index. It always does a sequential scan. No index scan eventhough the index is clearly there. We tried to reindex, recreate it, vacuum analyze, etc.... nothing works.
Then we accidentaly made it work?!? Strange?
Here is our first query (the one that does not work).
select * from product where item_number=1234
this query will NEVER use the index.
then we tried this:
select * from product where item_number='1234'
Notice the difference is just the single quotes!!! Now it uses the index all the time!
Wow, and this only happens with int8 / bigint.
I hope this will help somebody.
Andrew_@_PriceComparison.com
http://www.PriceComparison.com
:cheesy:
And I have just solved something quite remarkable and hard to solve. For anyone who has any index using an int8 / bigint field.
You should take time to read this.
The problem start when we noticed that any query with that int8 field is always slow. Finally we did an 'explain' of the query.
The server never even cared of using the index. It always does a sequential scan. No index scan eventhough the index is clearly there. We tried to reindex, recreate it, vacuum analyze, etc.... nothing works.
Then we accidentaly made it work?!? Strange?
Here is our first query (the one that does not work).
select * from product where item_number=1234
this query will NEVER use the index.
then we tried this:
select * from product where item_number='1234'
Notice the difference is just the single quotes!!! Now it uses the index all the time!
Wow, and this only happens with int8 / bigint.
I hope this will help somebody.
Andrew_@_PriceComparison.com
http://www.PriceComparison.com
:cheesy:
![]() |
Similar Threads
- How to handle Single Quotes in Pl/SQL? (Oracle)
- insert single quotes (Oracle)
- single quotes(') problem in inserting data into database (PHP)
- return confirm () in php (PHP)
- Help me with my myspace clone (PHP)
- How to insert newline character (PHP)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the Database Design Forum
- Previous Thread: From chester Heres all the code. Sorry but I just encluded the code in here
- Next Thread: Database Advice
| Thread Tools | Search this Thread |





