Re: [PERFORM] Picking out the most recent row using a time stamp column

2011-02-24 Thread Michael Glaesemann
On Feb 24, 2011, at 14:55, Dave Crooke wrote: > Is there a more elegant way to write this, perhaps using PG-specific > extensions? SELECT DISTINCT ON (data.id_key) data.id_key, data.time_stamp, data.value FROM data ORDER BY data.id_key, data.time_stamp DESC; Michael Glaeseman

Re: [HACKERS] [PERFORM] Slow count(*) again...

2011-02-03 Thread Michael Glaesemann
read much of the rest of this thread, so others may have brought these up before. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance

Re: [PERFORM] Getting a random row

2009-10-13 Thread Michael Glaesemann
. Rtfm!. AIUI, rownum applies numbering to output rows in a SELECT statement, rather than some actual column of the table, which is likely what the OP is getting at. http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html Michael Glaesemann grzm seespotcode net -- Sent via pg

Re: [PERFORM] How to post Performance Questions

2009-09-14 Thread Michael Glaesemann
troubleshoot your problems far more rapidly. Can something similar be added to the footer of (at least) the performance list? Michael Glaesemann grzm seespotcode net -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http

Re: [PERFORM] Re: Query Optimization with Krusk al’s Algorithm

2008-05-10 Thread Michael Glaesemann
ather than actively exploring new, potential features. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance

Re: [PERFORM] EXPLAIN ANALYZE time calculations

2007-12-02 Thread Michael Glaesemann
/loops bit (which is why explain- analyze.info times and percentages are currently miscalculated). I took startup time to be the time to return the first row *of the first loop*. But it's actually the average startup time to return the first row *in each loop*, right? Michael Glaesemann

[PERFORM] EXPLAIN ANALYZE time calculations

2007-12-02 Thread Michael Glaesemann
452 ms - 12.700 ms = 1.752 ms: 12% Is this correct? Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [PERFORM] Improving Query

2007-10-30 Thread Michael Glaesemann
our server configuration. Unfortunately I don't have the time to look at the query plan in more detail, but I suspect there's a better way to get the results you're looking for. Michael Glaesemann grzm seespotcode net ---(end of broadcast)-

Re: [PERFORM] Optimising "in" queries

2007-08-22 Thread Michael Glaesemann
(z = b) OR ... or somehow add it to the join list, so performance will vary. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if yo

Re: [PERFORM] Optimising "in" queries

2007-08-22 Thread Michael Glaesemann
processing in postgres is SLOW. Um, what array processing are you seeing here? IN (a, b, b) is not an array construct. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [PERFORM] Autovacuum is running forever

2007-08-21 Thread Michael Glaesemann
h for your system, so it's never able to catch up. Without knowing details it's hard to say for certain. What are your autovacuum settings and other details about the load on your system? Michael Glaesemann grzm seespotcode net

Re: [PERFORM] insert vs select into performance

2007-07-17 Thread Michael Glaesemann
On Jul 17, 2007, at 15:50 , Thomas Finneid wrote: Michael Glaesemann wrote: 2a) Are you using INSERT INTO foo (foo1, foo2, foo2) SELECT foo1, foo2, foo3 FROM pre_foo or individual inserts for each row? The former would be faster than the latter. performed with JDBC insert into

Re: [PERFORM] insert vs select into performance

2007-07-17 Thread Michael Glaesemann
r. 2b) If you are doing individual inserts, are you wrapping them in a transaction? The latter would be faster. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to

Re: [PERFORM] Advice about how to delete

2007-07-06 Thread Michael Glaesemann
should execute pretty quickly. You don't need to loop over any results. Remember, SQL is a set-based language, so if you can pose your question in a set-based way, you can probably find a pretty good, efficient solution. Michael Glaesemann grzm seespotcode net

Re: [PERFORM] Slow join query

2007-06-22 Thread Michael Glaesemann
[Please don't top post as it makes the discussion more difficult to follow.] On Jun 22, 2007, at 16:25 , Tom Tamulewicz wrote: The explain is as follows... EXPLAIN ANALYZE, please. (And for convenience, it helps if you include the query :) ) Michael Glaesemann grzm seespotcod

Re: [PERFORM] Slow join query

2007-06-22 Thread Michael Glaesemann
reparse and replan the query. Of course, if you change the arguments, it can't use the result that's cached from the previous run. Take this all with an appropriate amount of salt. I'm learning about this, too. Michael Glaesemann grzm seespotcode net --

Re: [PERFORM] Slow indexscan

2007-06-20 Thread Michael Glaesemann
ating that the query will return 13 rows, but you're actually returning 539. Maybe there's some corruption in the index which is leading to both the performance issue you're seeing and the statistics issues. Have you tried REINDEX? Michael Glaesemann

Re: [PERFORM] test / live environment, major performance difference

2007-06-12 Thread Michael Glaesemann
x and looking up the corresponding row. If you want to test this, you can set enable_seqscan to false and try running your query again. http://www.postgresql.org/docs/8.2/interactive/runtime-config- query.html#RUNTIME-CONFIG-QUERY-ENABLE Michael Glaesemann grzm seespotcod

Re: [PERFORM] Weird 8.2.4 performance

2007-06-06 Thread Michael Glaesemann
e's a performance difference. The weird thing is that on 8.2, I don't see any sequential scans taking place, it seems to be properly using the indexes. As an aside, whether the planner decides to use a sequential scan or an index has more to do with the particular query: indexes a

Re: [PERFORM] Seq Scan

2007-06-01 Thread Michael Glaesemann
id column value for each row in the table. The fastest way to do this is visiting every row., i.e., a sequential scan. Using an index would require (1) looking in the index and (2) looking up the corresponding row. Michael Glaesemann grzm seespotcode net ---(end of

Re: [PERFORM] Very slow left outer join

2007-05-29 Thread Michael Glaesemann
an ANALYZE? Your row estimates look off by a couple orders of magnitude. With up- to-date statistics the planner might do a better job. As for any other improvements, I'll leave that to those that know more than I. :) Michael Glaesemann grzm seespotcode net ---

Re: [PERFORM] Vacuum v/s Autovacuum

2007-01-18 Thread Michael Glaesemann
routine maintenance). Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [PERFORM] Version Change

2007-01-17 Thread Michael Glaesemann
tical tasks for your current 8.1.3 installation and then compare the results with those same benchmarks run against 8.2. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donati

Re: [PERFORM] Version Change

2007-01-17 Thread Michael Glaesemann
On Jan 18, 2007, at 13:56 , Michael Glaesemann wrote: On Jan 18, 2007, at 13:43 , Gauri Kanekar wrote: Can anybody suggest some comprehensive test for version change from 8.1.3 to 8.2 http://www.postgresql.org/docs/8.2/interactive/release.html Sorry, I misread your request as a list of

Re: [PERFORM] Version Change

2007-01-17 Thread Michael Glaesemann
On Jan 18, 2007, at 13:43 , Gauri Kanekar wrote: Can anybody suggest some comprehensive test for version change from 8.1.3 to 8.2 http://www.postgresql.org/docs/8.2/interactive/release.html Michael Glaesemann grzm seespotcode net ---(end of broadcast

Re: [PERFORM] New to PostgreSQL, performance considerations

2006-12-13 Thread Michael Glaesemann
ould think. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [PERFORM] Index ignored on column containing mostly 0 values

2006-10-30 Thread Michael Glaesemann
r_index on foos(bar) where bar <> 0; Take a look on the docs on partial indexes for more information. http://www.postgresql.org/docs/current/interactive/indexes-partial.html Hope this helps. Michael Glaesemann grzm seespotcode net ---(end of broadcast)

Re: [PERFORM] [Fwd: Delivery Status Notification (Failure)]

2006-07-12 Thread Michael Glaesemann
side of the list entirely, so any returned mail is also outside of the list. I've seen this happen occasionally myself. Could this be what you're seeing? AFAICT, such messages sent to the list *do* get filtered out. Michael Glaesemann grzm seespotcode net

Re: [PERFORM] Performance of DOMAINs

2006-06-21 Thread Michael Glaesemann
it can do what you're looking for. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [PERFORM] UNSUBSCRIBE

2006-05-09 Thread Michael Glaesemann
e list emails? Now *that'd* be sweet.) Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [PERFORM] PostgreSQL VACCUM killing CPU

2006-05-09 Thread Michael Glaesemann
I have got such problem. Im running Postgresql 7.3.2 on Linux 2.6.13. Also, you should seriously consider upgrading. 8.1.3 is the current PostgreSQL release. If you must remain on 7.3, at least upgrade to 7.3.14, which contains many bugfixes. Michael Glaesemann grzm seespotcode net

Re: [PERFORM] PostgreSQL VACCUM killing CPU

2006-05-09 Thread Michael Glaesemann
I have got such problem. Im running Postgresql 7.3.2 on Linux 2.6.13. Also, you should seriously consider upgrading. 8.1.3 is the current PostgreSQL release. If you must remain on 7.3, at least upgrade to 7.3.14, which contains *many* bugfixes. Michael Glaesemann grzm seespotcode net

Re: [PERFORM] FOREIGN KEYS vs PERFORMANCE

2006-04-12 Thread Michael Glaesemann
eople. For more specific advice (e.g., for your particular situation), it would be very helpful if you could provide examples of queries that aren't performing well for you (including table schema and explain analyze output). Michael Glaesemann grzm myr

Re: [PERFORM] FOREIGN KEYS vs PERFORMANCE

2006-04-11 Thread Michael Glaesemann
on to your database- level checks. Michael Glaesemann grzm myrealbox com ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [PERFORM] nested query on last n rows of huge table

2006-02-28 Thread Michael Glaesemann
( SELECT * FROM table ORDER eventtime DESC LIMIT 1000 ) as most_recent_1000 Don't know enough about the other parts, but hopefully this can get you started. :) Michael Glaesemann grzm myrealbox com ---(end of broa

Re: [PERFORM] indexes on primary and foreign keys

2006-01-11 Thread Michael Glaesemann
higher[2]. [1](http://www.postgresql.org/docs/current/interactive/sql-set.html) [2](http://www.postgresql.org/docs/current/interactive/runtime-config- logging.html#RUNTIME-CONFIG-LOGGING-WHEN) Michael Glaesemann grzm myrealbox com ---(end of broadcast)-

Re: [PERFORM] Improving Inner Join Performance

2006-01-06 Thread Michael Glaesemann
planning. VACUUM alone does not do this. Do you have an index on report.id_order ? Try creating an index for it if not and run a vacuum analyze on the table to see if it gets rid of the sequence scan in the plan. Michael Glaesemann grzm myrealbox com ---(end of

Re: [PERFORM] What is the max number of database I can create in an instance of pgsql?

2005-11-18 Thread Michael Glaesemann
your hardware. Michael Glaesemann grzm myrealbox com ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through t

Re: [PERFORM] Performance analysis of plpgsql code

2005-06-27 Thread Michael Glaesemann
l.org/docs/8.0/interactive/functions- datetime.html#FUNCTIONS-DATETIME-CURRENT> Michael Glaesemann grzm myrealbox com ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [PERFORM] Querying 19million records very slowly

2005-06-22 Thread Michael Glaesemann
ffset for the appropriate timestamptz values. There has been discussion in the past on storing the time zone name with the timestamptz as well, though no one has implemented this yet. Michael Glaesemann grzm myrealbox com ---(end of broadcast)--- TIP

Re: [PERFORM] Checking = with timestamp field is slow

2004-11-05 Thread Michael Glaesemann
On Nov 5, 2004, at 5:14 PM, Michael Glaesemann wrote: On Nov 5, 2004, at 4:16 PM, Antony Paul wrote: where today::date = '2004-11-05'; This is the only condition in the query. There is a btree index on the column today. Is there any way to optimise it. I'm sure others out there ha

Re: [PERFORM] Checking = with timestamp field is slow

2004-11-05 Thread Michael Glaesemann
ent_date = date '2004-11-05' Might not make a difference at all, but perhaps PostgreSQL is coercing both values to timestamp or some other type as you're only providing a string to compare to a date. Then again, it might make no difference at all. My 1 cent. Michael

Re: [PERFORM] Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables

2004-09-14 Thread Michael Glaesemann
is compare to DB2 partitioning? Michael Glaesemann grzm myrealbox com ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [PERFORM] NUMERIC x VARCHAR

2004-08-11 Thread Michael Glaesemann
1 | 12345678911234 | 012345678911234 (1 row) I would do as another poster suggested: create a telephone number domain as text with the check constraints you desire. Michael Glaesemann grzm myrealbox com ---(end of broadcast)--- TIP 7: don't forget to inc