Re: [GENERAL] inserting, index and no index - speed

2001-06-08 Thread Tom Lane
[EMAIL PROTECTED] writes: > I just noticed that inserting 1 tuples in an indexed table took exactly > the same amount of time as inserting 1 tuples in a non-indexed table > (194 seconds). Why is this? The difference in MySQL is about 50% longer in > an indexed table. Surprises me too. Wh

Re: [GENERAL] inserting, index and no index - speed

2001-06-10 Thread zilch
The test script that set up the tables is the following: --- /* Cleanup */ DROP SEQUENCE index_with_id_seq; DROP SEQUENCE index_without_id_seq; DROP INDEX name_index; DROP TABLE index_with; DROP TABLE index_without; /* Create a table with an index */ CREATE TABLE index_with ( id SERIAL,

Re: [GENERAL] inserting, index and no index - speed

2001-06-10 Thread zilch
. > > Thanks > > Daniel Akerud > > > Did you VACUUM ANALYZE as well, after you created the tables/indexes? > > > > - Original Message - > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Sunday, June 10, 2

Re: [GENERAL] inserting, index and no index - speed

2001-06-10 Thread zilch
Thanks Tom, really appreciate it! Daniel Akerud > [EMAIL PROTECTED] writes: > > CREATE TABLE index_with ( > > id SERIAL, > > name TEXT > > ); > > CREATE INDEX name_index ON index_with(name); > > > CREATE TABLE index_without ( > > id SERIAL, > > name TEXT > > ); > > Actually, what you

Re: [GENERAL] inserting, index and no index - speed

2001-06-10 Thread zilch
> You might try running the ten thousand inserts as a single transaction > (do "begin" and "end" around them). A HUGE difference (also completely took away the ID field (serial) having only name): Database vacuumed pg: Trying 25000 inserts on index_with... Time taken: 12 seconds Database vac

Re: [GENERAL] inserting, index and no index - speed

2001-06-10 Thread Tom Lane
[EMAIL PROTECTED] writes: > I can't believe what a difference that made. How can it make it faster by > putting it in a transaction? I thought that would make it slower. Like only > a 100th of the time. Everything is always a transaction in Postgres. If you don't say begin/end, then there's an i