[GENERAL] Which query is less expensive / faster?

2005-02-24 Thread Postgres Coder
Hi all, I have a couple different ways to get results out of my table structure, but I'm unsure which way is faster or less expensive to run: Option 1: Query a table of 4 million rows, on 4 indexed columns. It will return 1 row: SELECT field1, field2, field3, field4 FROM tablea WHERE field1 =

Re: [GENERAL] Which query is less expensive / faster?

2005-02-24 Thread Tzahi Fadida
esql.org > Subject: [GENERAL] Which query is less expensive / faster? > > > Hi all, > > I have a couple different ways to get results out of my table > structure, but I'm unsure which way is faster or less expensive to > run: > > Option 1: Query a table of 4 m

Re: [GENERAL] Which query is less expensive / faster?

2005-02-24 Thread Jon Asher
s Coder'; pgsql-general@postgresql.org Subject: Re: [GENERAL] Which query is less expensive / faster? I am not an expert to postgres internals but in General: if you have a btree multicolumn index on the 4 fields then it should take around logF(4M). lets guess the F to be 5 so its around 10 ios +1

Re: [GENERAL] Which query is less expensive / faster?

2005-02-25 Thread Richard Huxton
Jon Asher wrote: Thanks for the reply... but which query will be faster and less expensive? I don't have a table now with 4 million rows, but I'm thinking of building such a table. Querying it would return 1 row. The alternative is to query an existing table of 200k rows, and return 800 rows. Opt

Re: [GENERAL] Which query is less expensive / faster?

2005-02-25 Thread Richard Huxton
Jon Asher wrote: Thanks for the reply... but which query will be faster and less expensive? I don't have a table now with 4 million rows, but I'm thinking of building such a table. Querying it would return 1 row. The alternative is to query an existing table of 200k rows, and return 800 rows. Act