pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedwhich will be faster? w/ or w/o indices
3+ messages / 3 participants
[nested] [flat]
* which will be faster? w/ or w/o indices
@ 2003-02-07 08:04 val@webtribe.net
2003-02-07 09:36 ` Re: which will be faster? w/ or w/o indices dev@archonet.com
0 siblings, 1 reply; 3+ messages in thread
From: val@webtribe.net @ 2003-02-07 08:04 UTC (permalink / raw)
To: pgsql-sql
I understand that if you are importing data into the database
that this will go faster if there are no indices against the
target table.
If I want to run this statement:
INSERT INTO table_a SELECT * from table_b WHERE value_1 BETWEEN
X AND Y;
is it best to do that with or without indices?
AND, if I want to run this statement:
DELETE FROM table_B WHERE value_1 BETWEEN X AND Y;
is it best to do that with or without indices?
We are using v 7.2.1 on a Sun E4500.
TIA,
val
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: which will be faster? w/ or w/o indices
2003-02-07 08:04 which will be faster? w/ or w/o indices val@webtribe.net
@ 2003-02-07 09:36 ` dev@archonet.com
2003-02-07 17:26 ` Re: which will be faster? w/ or w/o indices Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 3+ messages in thread
From: dev@archonet.com @ 2003-02-07 09:36 UTC (permalink / raw)
To: val@webtribe.net; +Cc: pgsql-sql
> I understand that if you are importing data into the database
> that this will go faster if there are no indices against the
> target table.
>
> If I want to run this statement:
> INSERT INTO table_a SELECT * from table_b WHERE value_1 BETWEEN
> X AND Y;
> is it best to do that with or without indices?
Can't really say without testing - it'll depend on the size of the various
tables, X and Y disk speeds etc. The only suggestion I can make is to try
an EXPLAIN (Reference manual, SQL commands) with and without
ENABLE_SEQSCAN off (Admin guide ch 3.2).
- Richard Huxton
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: which will be faster? w/ or w/o indices
2003-02-07 08:04 which will be faster? w/ or w/o indices val@webtribe.net
2003-02-07 09:36 ` Re: which will be faster? w/ or w/o indices dev@archonet.com
@ 2003-02-07 17:26 ` Josh Berkus <josh@agliodbs.com>
0 siblings, 0 replies; 3+ messages in thread
From: Josh Berkus @ 2003-02-07 17:26 UTC (permalink / raw)
To: dev@archonet.com; val@webtribe.net; +Cc: pgsql-sql
Val,
> Can't really say without testing - it'll depend on the size of the various
> tables, X and Y disk speeds etc. The only suggestion I can make is to try
> an EXPLAIN (Reference manual, SQL commands) with and without
> ENABLE_SEQSCAN off (Admin guide ch 3.2).
Please use EXPLAIN ANALYZE instead of just EXPLAIN. That will show you
whether you have performance problems due to things outside of the planner's
control.
Keep in mind, though, that if your system has no special problems and your
planner statistics are up to date, the planner will do a good job of deciding
whether or not indexes are faster. You don't need to start out
second-guessing the planner ... you're likely to be wrong more often that it
is. Save that for real problem queries.
Also, upgrade to 7.2.4!!! 7.2.1 has several significant bugs, including two
security exploits and one backup-and-restore bug that could make it difficult
to recover your database from a backup file.
--
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-02-07 17:26 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-07 08:04 which will be faster? w/ or w/o indices val@webtribe.net
2003-02-07 09:36 ` dev@archonet.com
2003-02-07 17:26 ` Josh Berkus <josh@agliodbs.com>
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