473,395 Members | 1,584 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,395 software developers and data experts.

how can I change a btree index into a hash index?

I create a table like so:

create table types (
typeid integer unique not null,
typename varchar(255) unique not null
);

and I get the expected messages:

NOTICE: CREATE TABLE / UNIQUE will create implicit index 'types_typeid_key' for table 'types'
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'types_typename_key' for table 'types

Since these are all unique things, and will only be tested for
equality, I am guessing that making a hash index will be better
than making a btree index.

1. Exactly how do I do this? I'm getting some hints that I should
drop a constraint rather than drop an index, but I'm still
not sure exactly what to type.

2. Is this in general a good idea? I will benchmark both ways
but I'm interested in hearing any discussions regarding
hashed indexing.

Many TIA!
Mark
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #1
2 2548
Mark Harrison <mh@pixar.com> writes:
Since these are all unique things, and will only be tested for
equality, I am guessing that making a hash index will be better
than making a btree index.


You are mistaken. If there were any real value in that, we'd offer
an easier way to do it.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #2
On Thu, 2003-11-13 at 10:01, Tom Lane wrote:
Mark Harrison <mh@pixar.com> writes:
Since these are all unique things, and will only be tested for
equality, I am guessing that making a hash index will be better
than making a btree index.


You are mistaken. If there were any real value in that, we'd offer
an easier way to do it.

regards, tom lane


Hash indices also have locking restrictions that make them less useful
in most applications.

Stephen
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #3

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

Similar topics

5
by: Nobody | last post by:
I am trying to write a BTree class, just wondering if I missed any useful methods. This is my class definition so far (excuse the MFC portions, its a project requirement): template <class TYPE,...
1
by: Abhijit Ray | last post by:
I am using hash_set which is available from gcc ( and which i presume is not part of the C++ standard yet ) okay , In hash tables the key is used by a hash function to calculate a index and the...
4
by: Eloff | last post by:
I've got 100MB of urls organized by domain and then by document. I thought that a hastable of hastables or a btree of btrees would be a good way to lookup a specific url quickly by first finding...
1
by: Brian Maguire | last post by:
Can too many btree indexes cause page level locking? I read this... http://www.postgresql.org/docs/7.4/static/locking-indexes.html
2
by: Dennis Ålund | last post by:
Is it possible to notice a change of window.location.hash without polling? I'm working on a Ajax-platform (yes, inventing the wheel again) and have finished almost everything except the support...
0
by: sudhi nair | last post by:
hi dba's i want an automated script for converting btree index (with less cardinality) to bitmap index bcoz old version is 10g std edition now migration to 10g enterp edition any body know pls...
122
by: C.L. | last post by:
I was looking for a function or method that would return the index to the first matching element in a list. Coming from a C++ STL background, I thought it might be called "find". My first stop was...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
2
by: db2db2db2 | last post by:
hello all, we know that db2 create index using B-Tree,but if i want to create index using hash structure,how can i do it? in my opinion, db2 usually create index using B-tree,my question is if db2...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.