Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
hope I understand the planner behavior for my queries better now. Regards, Milan Zamazal -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
> "PS" == Pavel Stehule writes: PS> and value efective_cache_size ??? effective_cache_size = 128MB PS> what is CREATE INDEX stament for index? create index foo2_value_idx on foo2(value); -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to you

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
> "PS" == Pavel Stehule writes: PS> Have you original values random_page_cost and seq_page_cost in PS> postgres.conf? Yes. To be sure I uncommented the values in postgresql.conf seq_page_cost = 1.0 # measured on an arbitrary scale random_page_cost = 4.0

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
> "GJ" == Grzegorz Jaƛkiewicz writes: GJ> Do you seriously need to walk the user through couple of million GJ> rows of data ? Typically not. Data can be of any size. Some tables may be large and I'd like to understand what happens. It is a general data browser. -- Sent via pgsq

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
> "AL" == Albe Laurenz writes: AL> Did you try to reduce the cursor_tuple_fraction parameter? No, good idea, thanks. It helps. The question is whether it's a good idea to reduce cursor_tuple_fraction universally, without knowing the table size before (and I'm not going to use SELECT CO

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
> "PS" == Pavel Stehule writes: PS> please EXPLAIN ANALYZE Pavel I see, I'm sorry. Here are the results: set enable_seqscan = on; explain analyze declare c cursor for select * from foo2 order by value; QUERY PLAN

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
QUERY PLAN - Index Scan using foo2_value_idx on foo2 (cost=0.00..32220140.73 rows=999 width=10) (1 row) Regards, Milan Zamazal -- Sent via pgsql-general mailing list (pgsql-general@pos

Re: [GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
>>>>> "FR" == Filip RembiaƂkowski writes: FR> 2010/1/5 Milan Zamazal >> - Is it a good idea to set enable_seqscan or enable_sort to "off" >> globally in my case? Or to set them to "off" just before working >&

[GENERAL] Large tables, ORDER BY and sequence/index scans

2010-01-05 Thread Milan Zamazal
My problem is that retrieving sorted data from large tables is sometimes very slow in PostgreSQL (8.4.1, FWIW). I typically retrieve the data using cursors, to display them in UI: BEGIN; DECLARE ... SELECT ... ORDER BY ...; FETCH ...; ... On a newly created table of about 10 million rows