pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
multicolumn index vs two indexes 2+ messages / 2 participants [nested] [flat]
* multicolumn index vs two indexes @ 2001-03-02 19:02 Salvador Mainé <salvamaine@yahoo.com> 2001-03-02 19:16 ` Re: multicolumn index vs two indexes Peter Eisentraut <peter_e@gmx.net> 0 siblings, 1 reply; 2+ messages in thread From: Salvador Mainé @ 2001-03-02 19:02 UTC (permalink / raw) To: pgsql-admin Hello: I have a table whith an id field, a date field and 5 millions rows. I need make queries like select *on table where id='001' and fecha >='1-1-1999' and fecha <'1-1-2000'; What is better? To create a multicolumn btree index with (date, id) or two indexes, one btree for the date and a hash for the id? Where can I find mor accurate info about indexes? (the manual is a little bit short of it). Thanks -- Salva ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: multicolumn index vs two indexes 2001-03-02 19:02 multicolumn index vs two indexes Salvador Mainé <salvamaine@yahoo.com> @ 2001-03-02 19:16 ` Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 2+ messages in thread From: Peter Eisentraut @ 2001-03-02 19:16 UTC (permalink / raw) To: salva@ronincoders.com; +Cc: pgsql-admin Salvador Mainé writes: > I have a table whith an id field, a date field and 5 millions rows. I > need make queries like > > select *on table where id='001' and fecha >='1-1-1999' and fecha > <'1-1-2000'; > > What is better? To create a multicolumn btree index with (date, id) or > two indexes, one btree for the date and a hash for the id? A query can only use at most one index, so two indices is out. Perhaps it would also make sense to create an index on "id" only, depending on what the selectivity is. > Where can I find mor accurate info about indexes? (the manual is a > little bit short of it). Try the 7.1 manual: http://www.postgresql.org/devel-corner/docs/postgres/indices.html -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/ ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-03-02 19:16 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2001-03-02 19:02 multicolumn index vs two indexes Salvador Mainé <salvamaine@yahoo.com> 2001-03-02 19:16 ` Peter Eisentraut <peter_e@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox