Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-27 Thread Evgeniy Shishkin
On 28.05.2013, at 2:17, John Mudd wrote: > Thanks again. > > Well, I have two problems with using the CLUSTER option. It's only temporary > since any updates, depending how much free space is reserved per page, > requires re-running the CLUSTER. And my primary concern is that it > arbitra

Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-27 Thread John Mudd
Thanks again. Well, I have two problems with using the CLUSTER option. It's only temporary since any updates, depending how much free space is reserved per page, requires re-running the CLUSTER. And my primary concern is that it arbitrarily gives an unfair advantage to the primary key SELECT. Stil

Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-27 Thread Evgeny Shishkin
On May 27, 2013, at 6:35 PM, John Mudd wrote: > Thanks, that's easy enough to test. Didn't seem to help though. > Ok. And if you CLUSTER tables USING PK? > > test=# REINDEX index test_select_pkey; > REINDEX > test=# VACUUM ANALYZE test_select ; > VACUUM > > > (stopped postgres; reset O/S c

Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-27 Thread John Mudd
Thanks, that's easy enough to test. Didn't seem to help though. test=# REINDEX index test_select_pkey; REINDEX test=# VACUUM ANALYZE test_select ; VACUUM (stopped postgres; reset O/S cache; started postgres) test=# explain analyze SELECT * FROM test_select WHERE key1 >= 50 ORDER BY key1, k

Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-27 Thread Evgeny Shishkin
On May 27, 2013, at 6:02 PM, John Mudd wrote: > Postgres 9.1.2 on Ubuntu 12.04 > > Any reason why a select by primary key would be slower than a select that > includes an ORDER BY? I was really hoping using the primary key would give me > a boost. > You created my_key after data loading, a

[PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-27 Thread John Mudd
Postgres 9.1.2 on Ubuntu 12.04 Any reason why a select by primary key would be slower than a select that includes an ORDER BY? I was really hoping using the primary key would give me a boost. I stopped the server and cleared the O/S cache using "sync; echo 3 > /proc/sys/vm/drop_caches" between th