473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

BIGINT indexes still with problems

Hi, I have read in this list and elsewhere the problem with indexes and big int.
Still, I have an index that is used or not, depending of the parameter value used in the query.
I am using PostgreSQL 7.4.3 on Linux RH ES3.

Here's the table:
test=> \d dmaildatum
Table "public.dmaildatum"
Column | Type | Modifiers
----------------+-----------------------------+-----------
id | bigint | not null
type | integer | not null
idowneruser | bigint | not null
idparent | bigint | not null
creationdate | timestamp without time zone | not null
name | character varying(1024) | not null
deletedate | timestamp without time zone | not null
lastmodifydate | timestamp without time zone |
ffrom | character varying(255) |
fto | text |
fcc | text |
fbcc | text |
fsubject | text |
fdate | timestamp without time zone |
fread | boolean |
nattachments | integer |
fsize | bigint |
hashtml | boolean |
replyto | text |
pop3id | character varying(255) |
nvattachments | integer |
Indexes:
"dmaildatum_pkey" primary key, btree (id)
"ix_dmaildatum_fdate" btree (fdate)
"ix_dmaildatum_idowneruser" btree (idowneruser)
"ix_dmaildatum_idparent" btree (idparent)
"ix_dmaildatum_pop3id" btree (pop3id)
Foreign-key constraints:
"fk_dmaildatum_dmailfolderdatum" FOREIGN KEY (idparent) REFERENCES dmailfold
erdatum(id) ON DELETE CASCADE

Now, if I run this query (note the int8 cast - also tried with the '' cast to String, same results):
test=> explain select * from dmaildatum where idparent=int8(783219);
QUERY PLAN
------------------------------------------------------------------
Seq Scan on dmaildatum (cost=0.00..2241.71 rows=2229 width=272)
Filter: (idparent = 783219::bigint)
(2 rows)

The index is not used. But with an identical query, only different parameter value:
desknow=> explain select * from dmaildatum where idparent=int8(1187838);
QUERY PLAN

--------------------------------------------------------------------------------
---------------
Index Scan using ix_dmaildatum_idparent on dmaildatum (cost=0.00..284.05 rows=
102 width=272)
Index Cond: (idparent = 1187838::bigint)
(2 rows)

The index is used!
I also did a vacuum analyze, and restarted Postgres and it did not make any difference.
I tried many other ID values (ex 783218 and 783220), and they seem to use the index correctly. Only that value doesn't.

Can anyone explain why Postgres behaves differently in these two cases, or at least point to some hints?

Thanks in advance for all your help

--
_______________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/...sp?SRC=lycos10
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
0 1854

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: KK | last post by:
Hi, im working on this bigInt class. Need help writing algorithm for the operator*, andy help will be appreciated. Thanks in advance bigInt.h...
10
by: MK | last post by:
Hello, I use BigInt lib from: http://www.codeguru.com/Cpp/data/data-misc/values/article.php/c4563/ It doesn't work properly. I describe my problem:...
1
by: MK | last post by:
I need div two big int. I use this lib: https://sourceforge.net/projects/cpp-bigint/ I create simple project and include two file bigint.h and bigint.cpp (Precompiled headers is not using) When...
0
by: CSN | last post by:
I was scanning hackers - is there further info on the (possible) issues with bigint indexes and vacuuming (disk bandwidth?)? Thanks, CSN __________________________________ Do you Yahoo!?...
12
by: Rafał Maj Raf256 | last post by:
Hi, is there some small project that proviedes bigint, best as a C++ class, or just as set of struct/functions (C-style)? Something like GMP and it's bigint, but I want to have it just in one...
3
by: Dan Ruthers | last post by:
Hi, I have read in this list and elsewhere the problem with indexes and big int. Still, I have an index that is used or not, depending of the parameter value used in the query. I am using...
5
by: mamorgan1 | last post by:
We made a poor decision a long time ago when designing our database structure. We used bigint data types as the identity keys for many of our base tables. For many reasons I would like to change...
1
by: Rahul Babbar | last post by:
Hi, What are the possible ways to change the data type of a column from BigInt to Integer? the normal command Alter table <tabnamealter column <colnameset data type Integer gives the error...
7
by: scoots987 | last post by:
Does anyone have a suggestion to do this? I have a table in SQL Server that has it's primary key as Bigint. When viewing directly with ODBC all the fields and rows show "#Deleted". I've tried to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.