Re: [PERFORM] query a table with lots of coulmns

2014-09-19 Thread Szymon Guz
On 19 September 2014 13:51, Björn Wittich bjoern_witt...@gmx.de wrote: Hi mailing list, I am relatively new to postgres. I have a table with 500 coulmns and about 40 mio rows. I call this cache table where one column is a unique key (indexed) and the 499 columns (type integer) are some

Re: [PERFORM] question about partial index

2014-03-18 Thread Szymon Guz
On 18 March 2014 22:26, Yu Zhao yzha...@gmail.com wrote: In PostgreSQL 9.3.3 Documentation 11.8. Partial Indexes Example 11-2 (http://www.postgresql.org/docs/9.3/interactive/indexes-partial.html), the partial index is created CREATE INDEX orders_unbilled_index ON orders (order_nr) WHERE

Re: [PERFORM] SQL performance

2013-06-02 Thread Szymon Guz
On 2 June 2013 21:39, Robert DiFalco robert.difa...@gmail.com wrote: I have a table called contacts. It has a BIGINT owner_id which references a record in the user table. It also has a BIGINT user_id which may be null. Additionally it has a BOOLEAN blocked column to indicate if a contact is

Re: [PERFORM] [planner] Ignore order by in subselect if parrent do count(*)

2012-03-01 Thread Szymon Guz
On 1 March 2012 13:02, Marcin Mirosław mar...@mejor.pl wrote: W dniu 01.03.2012 12:50, Szymon Guz pisze: Hi Szymon, If you have only 2 rows in the table, then the plan really doesn't matter too much. Sorting two rows would be really fast :) Try to check it with 10k rows. It doesn't

Re: [PERFORM] Query tuning help

2011-10-11 Thread Szymon Guz
On 11 October 2011 19:52, CS DBA cs_...@consistentstate.com wrote: Hi all ; I'm trying to tune a difficult query. I have 2 tables: cust_acct (9million rows) cust_orders (200,000 rows) Here's the query: SELECT a.account_id, a.customer_id, a.order_id, a.primary_contact_id,

Re: [PERFORM] postgresql query runtime

2011-10-11 Thread Szymon Guz
On 11 October 2011 21:08, Radhya sahal rad_cs_2...@yahoo.com wrote: Hi I want to know how can i measure runtime query in postgresql if i use command line psql? not explain rutime for the query such as the runtime which appear in pgadmin ? such as Total query runtime: 203 ms. run this in

Re: [PERFORM] postgresql query runtime

2011-10-11 Thread Szymon Guz
On 11 October 2011 21:13, Szymon Guz mabew...@gmail.com wrote: On 11 October 2011 21:08, Radhya sahal rad_cs_2...@yahoo.com wrote: Hi I want to know how can i measure runtime query in postgresql if i use command line psql? not explain rutime for the query such as the runtime which appear

Re: [PERFORM] Which Join is better

2011-08-02 Thread Szymon Guz
On 2 August 2011 08:42, Adarsh Sharma adarsh.sha...@orkash.com wrote: Dear all, Just want to know which join is better for querying data faster. I have 2 tables A ( 70 GB ) B ( 7 MB ) A has 10 columns B has 3 columns.Indexes exist on both tables's ids. select p.* from table A p, B q

Re: [PERFORM] help speeding up a query in postgres 8.4.5

2011-04-06 Thread Szymon Guz
On 5 April 2011 21:25, Maria L. Wilson maria.l.wilso...@nasa.gov wrote: Would really appreciate someone taking a look at the query below Thanks in advance! this is on a linux box... Linux dsrvr201.larc.nasa.gov 2.6.18-164.9.1.el5 #1 SMP Wed Dec 9 03:27:37 EST 2009 x86_64 x86_64 x86_64

Re: [PERFORM] Running PostgreSQL as fast as possible no matter the consequences

2010-11-05 Thread Szymon Guz
On 5 November 2010 11:59, A B gentosa...@gmail.com wrote: Hi there. If you just wanted PostgreSQL to go as fast as possible WITHOUT any care for your data (you accept 100% dataloss and datacorruption if any error should occur), what settings should you use then? I'm just curious, what do

Re: [PERFORM] which one is faster

2010-10-26 Thread Szymon Guz
On 26 October 2010 12:56, AI Rumman rumman...@gmail.com wrote: Which one is faster? select count(*) from talble or select count(id) from table where id is the primary key. Check the query plan, both queries are the same. regards Szymon

Re: [PERFORM] which one is faster

2010-10-26 Thread Szymon Guz
2010/10/26 Marcin Mirosław mar...@mejor.pl W dniu 26.10.2010 12:59, Szymon Guz pisze: both queries are the same. IMHO they aren't the same, but they returns the same value in this case. I mean count(field) doesn't count NULL values, count(*) does it. I'm writing this only for note

Re: [PERFORM] which one is faster

2010-10-26 Thread Szymon Guz
2010/10/26 Grzegorz Jaśkiewicz gryz...@gmail.com implementation wise, count(*) is faster. Very easy to test: SELECT COUNT(*) FROM generate_series(1,100) a, generate_series(1,1000) b; SELECT COUNT(a) FROM generate_series(1,100) a, generate_series(1,1000) b; ;] Well, strange. Why is that

Re: [PERFORM] which one is faster

2010-10-26 Thread Szymon Guz
2010/10/26 Grzegorz Jaśkiewicz gryz...@gmail.com 2010/10/26 Szymon Guz mabew...@gmail.com: Well, strange. Why is that slower? To answer that fully, you would need to see the implementation. suffice to say, count(a) does: if (a NULL) { count++; } and count(*) does: count

Re: [PERFORM] why index is not working in operation?

2010-07-22 Thread Szymon Guz
, but the result is that the database knows, that it would be faster not to use index, if the number of returning rows is big. regards Szymon Guz

Re: [PERFORM] Slow function in queries SELECT clause.

2010-06-20 Thread Szymon Guz
Szymon Guz

Re: [PERFORM] query hangs

2010-06-10 Thread Szymon Guz
table pg_locks for locking issues, maybe the query is just slow but not hangs. Notice that the query just returns 2M rows, that can be quite huge number due to your database structure, data amount and current server configuration. regards Szymon Guz

Re: [PERFORM] query hangs

2010-06-10 Thread Szymon Guz
2010/6/10 AI Rumman rumman...@gmail.com I found only AccessShareLock in pg_locks during the query. And the query does not return data though I have been waiting for 10 mins. Do you have any idea ? On Thu, Jun 10, 2010 at 5:26 PM, Szymon Guz mabew...@gmail.com wrote: 2010/6/10 AI Rumman

Re: [PERFORM] SELECT ignoring index even though ORDER BY and LIMIT present

2010-06-02 Thread Szymon Guz
recent data. I have an index on the row creation date and I would like almost all of my queries to have a query plan looking something like: [CUT] Do you have autovacuum running? Have you tried updating statistics? regards Szymon Guz

Re: [PERFORM] Optimizer showing wrong rows in plan

2010-03-28 Thread Szymon Guz
automatically. No, explain doesn't update table's statistics. regards Szymon Guz

Re: [PERFORM] Optimizer showing wrong rows in plan

2010-03-28 Thread Szymon Guz
that there are 2400 rows in this table. Probably you've deleted some rows from the table leaving just one. regards Szymon Guz