Re: [PERFORM] difficulties with time based queries

2009-04-08 Thread Rainer Mager
So, I defragged my disk and reran my original query and it got a little better, but still far higher than I'd like. I then rebuilt (dropped and recreated) the ad_log_date_all index and reran the query and it is quite a bit better: # explain analyze select * from ad_log where date(start_time) <

Re: [PERFORM] Nested query performance issue

2009-04-08 Thread Glenn Maynard
(I didn't notice that I ended up with "score.score" in this test case. Oops.) 2009/4/8 Віталій Тимчишин : > How about > > select s1.* > from score s1 join score s2 on s1.game_id=s2.game_id and s2.score >= > s1.score > group by s1.* > having count(s2.*) <= N I can see what this is doing, but I'm

Re: [PERFORM] Nested query performance issue

2009-04-08 Thread Віталій Тимчишин
2009/4/9 Glenn Maynard > (This is related to an earlier post on -sql.) > > I'm querying for the N high scores for each game, with two tables: > scores and games. > > CREATE TABLE game (id SERIAL NOT NULL PRIMARY KEY); > CREATE TABLE score (id SERIAL NOT NULL PRIMARY KEY, score REAL, > game_id INT

[PERFORM] Nested query performance issue

2009-04-08 Thread Glenn Maynard
(This is related to an earlier post on -sql.) I'm querying for the N high scores for each game, with two tables: scores and games. CREATE TABLE game (id SERIAL NOT NULL PRIMARY KEY); CREATE TABLE score (id SERIAL NOT NULL PRIMARY KEY, score REAL, game_id INTEGER REFERENCES game (id)); -- test dat

Re: [PERFORM] Best replication solution?

2009-04-08 Thread Dimitri Fontaine
Hi, Ok I need to answer some more :) Le 8 avr. 09 à 20:20, Jeff a écrit : To add a table with a pk you edit slon_tools.conf and add something along the lines of: "someset" => { "set_id" => 5, "table_id" => 5, "pkeyedtables" => [ "tacos", "burritos", "gorditas" ] } th

Re: [PERFORM] Best replication solution?

2009-04-08 Thread Jeff
On Apr 7, 2009, at 1:18 PM, Andrew Sullivan wrote: I should have stated that differently. First, you're right that if you don't know where to look or what to look for, you can easily be unaware of nodes being out of sync. What's not a problem with Slony _$cluster.sl_status on the origin is

Re: [PERFORM] bad query plans for ~ "^string" (and like "string%") (8.3.6)

2009-04-08 Thread Tom Lane
Marinos Yannikos writes: > Marinos Yannikos wrote: >> (what exactly does ANALYZE look at for text columns? in our case, about >> 7% of the rows match the index condition, so it seems that left-anchored >> regexp/like matches are not evaluated using the gathered >> most-common-value list at all)

Re: [PERFORM] bad query plans for ~ "^string" (and like "string%") (8.3.6)

2009-04-08 Thread Robert Haas
On Wed, Apr 8, 2009 at 9:42 AM, Marinos Yannikos wrote: > It seems that ANALYZE does not really sample text column values as much as > it could. We have some very bad query plans resulting from this: > > ... >         ->  Bitmap Index Scan on m_pkey  (cost=0.00..28.61 rows=102 width=0) > (actual t

Re: [PERFORM] bad query plans for ~ "^string" (and like "string%") (8.3.6)

2009-04-08 Thread Marinos Yannikos
Marinos Yannikos wrote: (what exactly does ANALYZE look at for text columns? in our case, about 7% of the rows match the index condition, so it seems that left-anchored regexp/like matches are not evaluated using the gathered most-common-value list at all) oops, I think I gave myself the answ

[PERFORM] bad query plans for ~ "^string" (and like "string%") (8.3.6)

2009-04-08 Thread Marinos Yannikos
It seems that ANALYZE does not really sample text column values as much as it could. We have some very bad query plans resulting from this: ... -> Bitmap Index Scan on m_pkey (cost=0.00..28.61 rows=102 width=0) (actual time=171.824..171.824 rows=683923 loops=1) Index

Re: [PERFORM] Best replication solution?

2009-04-08 Thread Marinos Yannikos
Heikki Linnakangas wrote: Lists wrote: Server is a dual core xeon 3GB ram and 2 mirrors of 15k SAS drives (1 for most data, 1 for wal and a few tables and indexes) In total all databases on the server are about 10G on disk (about 2GB in pgdump format). I'd suggest buying as much RAM as you

Re: [PERFORM] plpgsql arrays

2009-04-08 Thread Matthew Wakeling
On Tue, 7 Apr 2009, Tom Lane wrote: Subsequent discussion showed that the problem was Matthew hadn't found that page. I guess that at least the DECLARE CURSOR reference page ought to have something like "if you are trying to use cursors in plpgsql, see ". Matthew, where *were* you looking exact

Re: [PERFORM] Best replication solution?

2009-04-08 Thread Mark Kirkwood
Andrew Sullivan wrote: I should have stated that differently. First, you're right that if you don't know where to look or what to look for, you can easily be unaware of nodes being out of sync. What's not a problem with Slony is that the nodes can get out of internally consistent sync state: i