RE: primary key scans in sequence
От | Stephan Szabo |
---|---|
Тема | RE: primary key scans in sequence |
Дата | |
Msg-id | Pine.BSF.4.21.0105310834480.11460-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | RE: primary key scans in sequence ("Koen Antonissen" <Koen@Cee-Kay.net>) |
Список | pgsql-sql |
It really depends on the number of rows. If the number of rows in the tables are small or the number of rows returned is a reasonable percentage, the index scan is currently more expensive. What does (for example) select count(*) from classes; give? On Thu, 31 May 2001, Koen Antonissen wrote: > actually the serials are declared int4 (integer), > I tried to use your work around anyway, but it didn't work...: > > dsc_competition=# \d classes > Table "classes" > Attribute | Type | Modifier > > ------------+---------+------------------------------------------------- > - > id | integer | not null default nextval('classes_id_seq'::text) > name | text | not null > definition | text | > active | boolean | default 't'::bool > Indices: classes_pkey, > index_classes_name, > unq_classes_name > > dsc_competition=# explain select * from classes where id = int8(4); > NOTICE: QUERY PLAN: > > Seq Scan on classes (cost=0.00..1.07 rows=1 width=29) > > EXPLAIN > dsc_competition=# explain select * from classes where id = int4(4); > NOTICE: QUERY PLAN: > > Seq Scan on classes (cost=0.00..1.07 rows=1 width=29) > > EXPLAIN > dsc_competition=# explain select * from classes where id = int2(4); > NOTICE: QUERY PLAN: > > Seq Scan on classes (cost=0.00..1.07 rows=1 width=29) > > EXPLAIN > > > > Thing I descovered after i posted to the group was that after creating > the scheme again, the indexes are used! after vacuum (analyze) the use > of indexes was gone again on certain tables... > > Any other suggestions?
В списке pgsql-sql по дате отправления: