pg.ddx.io  pgsql-students@postgresql.org mailing list archive  
help / color / mirror / Atom feed
query execution time
8+ messages / 4 participants
[nested] [flat]

* query execution time
@ 2011-03-21 04:59  preetika tyagi <preetikatyagi@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread

From: preetika tyagi @ 2011-03-21 04:59 UTC (permalink / raw)
  To: pgsql-students

Hi,

I am wondering if someone can help me understand the following query
execution behavior:

I have two similar tables and table2 consists of 5000000 records.

Query: INSERT INTO table1 SELECT * FROM table2.
Execution Time: A ms.

Query: INSERT INTO table1 SELECT * FROM table2.
Execution Time: B ms.

Sometimes B >> A (B is very larger than A). Both queries are same and run
twice. What could be the reason that the same query is taking very long
sometime?

Thanks a lot!

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: query execution time
@ 2011-03-21 05:09  Selena Deckelmann <selena@chesnok.com>
  parent: preetika tyagi <preetikatyagi@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Selena Deckelmann @ 2011-03-21 05:09 UTC (permalink / raw)
  To: preetika tyagi <preetikatyagi@gmail.com>; +Cc: pgsql-students

Hi!

This mailing list is for GSoC students to discuss their proposals.

Please direct your question to pgsql-general@postgresql.org.

-selena

On Sun, Mar 20, 2011 at 9:59 PM, preetika tyagi <preetikatyagi@gmail.com> wrote:
> Hi,
> I am wondering if someone can help me understand the following query
> execution behavior:
> I have two similar tables and table2 consists of 5000000 records.
> Query: INSERT INTO table1 SELECT * FROM table2.
> Execution Time: A ms.
> Query: INSERT INTO table1 SELECT * FROM table2.
> Execution Time: B ms.
> Sometimes B >> A (B is very larger than A). Both queries are same and run
> twice. What could be the reason that the same query is taking very long
> sometime?
> Thanks a lot!
>



-- 
http://chesnok.com



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* query execution time
@ 2011-03-21 05:12  preetika tyagi <preetikatyagi@gmail.com>
  parent: preetika tyagi <preetikatyagi@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: preetika tyagi @ 2011-03-21 05:12 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

Hi,

I am wondering if someone can help me understand the following query
execution behavior:

I have two similar tables and table2 consists of 5000000 records.

Query: INSERT INTO table1 SELECT * FROM table2.
Execution Time: A ms.

Query: INSERT INTO table1 SELECT * FROM table2.
Execution Time: B ms.

Sometimes B >> A (B is very larger than A). Both queries are same and run
twice. What could be the reason that the same query is taking very long
sometime?

Thanks a lot!

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: query execution time
@ 2011-03-21 09:48  Vibhor Kumar <vibhor.kumar@enterprisedb.com>
  parent: preetika tyagi <preetikatyagi@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Vibhor Kumar @ 2011-03-21 09:48 UTC (permalink / raw)
  To: preetika tyagi <preetikatyagi@gmail.com>; +Cc: pgsql-general@postgresql.org


On Mar 21, 2011, at 10:42 AM, preetika tyagi wrote:

> Query: INSERT INTO table1 SELECT * FROM table2.
> Execution Time: A ms.
> 
> Query: INSERT INTO table1 SELECT * FROM table2.
> Execution Time: B ms

If session is same, then
B < A if the data is cached due to execution of first statement.
 B > A, if the there is any change happened Or Any session has evicted the cached data.

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: query execution time
@ 2011-03-21 15:55  preetika tyagi <preetikatyagi@gmail.com>
  parent: Vibhor Kumar <vibhor.kumar@enterprisedb.com>
  0 siblings, 1 reply; 8+ messages in thread

From: preetika tyagi @ 2011-03-21 15:55 UTC (permalink / raw)
  To: Vibhor Kumar <vibhor.kumar@enterprisedb.com>; +Cc: pgsql-general@postgresql.org

Thank you, Vibhor!

I am wondering if caching will make such a big difference. For example, if A
is 15 minutes, then B is 1.5 hrs.
What could be other factors in case database server is separated from
clients (on different computer systems)?

Preetika

On Mon, Mar 21, 2011 at 2:48 AM, Vibhor Kumar <vibhor.kumar@enterprisedb.com
> wrote:

>
> On Mar 21, 2011, at 10:42 AM, preetika tyagi wrote:
>
> > Query: INSERT INTO table1 SELECT * FROM table2.
> > Execution Time: A ms.
> >
> > Query: INSERT INTO table1 SELECT * FROM table2.
> > Execution Time: B ms
>
> If session is same, then
> B < A if the data is cached due to execution of first statement.
>  B > A, if the there is any change happened Or Any session has evicted the
> cached data.
>
> Thanks & Regards,
> Vibhor Kumar
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
> vibhor.kumar@enterprisedb.com
> Blog:http://vibhork.blogspot.com
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: query execution time
@ 2011-03-21 16:06  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: preetika tyagi <preetikatyagi@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Scott Ribe @ 2011-03-21 16:06 UTC (permalink / raw)
  To: preetika tyagi <preetikatyagi@gmail.com>; +Cc: pgsql-general@postgresql.org General <pgsql-general@postgresql.org>

On Mar 21, 2011, at 9:55 AM, preetika tyagi wrote:

> For example, if A is 15 minutes, then B is 1.5 hrs. 

Well, considering that random disk access is on the order of 10,000 times slower than RAM...

But you can answer the question yourself by comparing the query run against cold caches (after a reboot, or various command-line tricks to purge cache) vs against warm caches (twice back-to-back).

-- 
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice







^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: query execution time
@ 2011-03-21 18:03  preetika tyagi <preetikatyagi@gmail.com>
  parent: Scott Ribe <scott_ribe@elevated-dev.com>
  0 siblings, 1 reply; 8+ messages in thread

From: preetika tyagi @ 2011-03-21 18:03 UTC (permalink / raw)
  To: Scott Ribe <scott_ribe@elevated-dev.com>; +Cc: pgsql-general@postgresql.org General <pgsql-general@postgresql.org>

Thank you, Scott!
I tried running the same query after reboot and back-to-back, it was taking
less time in both the cases. It means the problem is something else.

Can there be a reason which is more hardware/operating system specific and
due to which the behavior is not uniform?

Preetika

On Mon, Mar 21, 2011 at 9:06 AM, Scott Ribe <scott_ribe@elevated-dev.com>wrote:

> On Mar 21, 2011, at 9:55 AM, preetika tyagi wrote:
>
> > For example, if A is 15 minutes, then B is 1.5 hrs.
>
> Well, considering that random disk access is on the order of 10,000 times
> slower than RAM...
>
> But you can answer the question yourself by comparing the query run against
> cold caches (after a reboot, or various command-line tricks to purge cache)
> vs against warm caches (twice back-to-back).
>
> --
> Scott Ribe
> scott_ribe@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
>
>
>
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: query execution time
@ 2011-03-21 20:30  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: preetika tyagi <preetikatyagi@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Scott Ribe @ 2011-03-21 20:30 UTC (permalink / raw)
  To: preetika tyagi <preetikatyagi@gmail.com>; +Cc: pgsql-general@postgresql.org General <pgsql-general@postgresql.org>

On Mar 21, 2011, at 12:03 PM, preetika tyagi wrote:

> I tried running the same query after reboot and back-to-back, it was taking less time in both the cases. It means the problem is something else.
> 
> Can there be a reason which is more hardware/operating system specific and due to which the behavior is not uniform?

While I do have a couple of ideas, you're probably better served by letting those here with more optimization experience help you, as their answers will be more complete.

-- 
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice







^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2011-03-21 20:30 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-03-21 04:59 query execution time preetika tyagi <preetikatyagi@gmail.com>
2011-03-21 05:09 ` Selena Deckelmann <selena@chesnok.com>
2011-03-21 05:12 ` preetika tyagi <preetikatyagi@gmail.com>
2011-03-21 09:48   ` Vibhor Kumar <vibhor.kumar@enterprisedb.com>
2011-03-21 15:55     ` preetika tyagi <preetikatyagi@gmail.com>
2011-03-21 16:06       ` Scott Ribe <scott_ribe@elevated-dev.com>
2011-03-21 18:03         ` preetika tyagi <preetikatyagi@gmail.com>
2011-03-21 20:30           ` Scott Ribe <scott_ribe@elevated-dev.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox