public inbox for [email protected]  
help / color / mirror / Atom feed
Re.  Select with where condition times out
3+ messages / 3 participants
[nested] [flat]

* Re.  Select with where condition times out
@ 2024-07-18 09:38 [email protected] <[email protected]>
  2024-07-18 09:42 ` Re: Re. Select with where condition times out Kashif Zeeshan <[email protected]>
  2024-07-18 11:53 ` Re: Re. Select with where condition times out Francisco Olarte <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: [email protected] @ 2024-07-18 09:38 UTC (permalink / raw)
  To: Postgresql General Group <[email protected]>

Hello,PG V11
Select count(*) from table1Returns 10456432
Select field1, field2 from table1 where field3> '2024-07-18 12:00:00' Times out
The above query was working fine for the past 2 years.  
Backup was taken a day back.  Need to recover complete data as far as possible.
Any possible way(s) to do this?
BKR Sivaprakash 

Yahoo Mail: Search, organise, conquer

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

* Re: Re. Select with where condition times out
  2024-07-18 09:38 Re.  Select with where condition times out [email protected] <[email protected]>
@ 2024-07-18 09:42 ` Kashif Zeeshan <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Kashif Zeeshan @ 2024-07-18 09:42 UTC (permalink / raw)
  To: [email protected] <[email protected]>; +Cc: Postgresql General Group <[email protected]>

Hi

It can be caused due to Table Bloat, table bloat can slow down queries. Use
the pg_repack extension or VACUUM FULL to try ti fix this table bloat issue.
You can refer to following link
https://supabase.com/blog/postgres-bloat

Regards
Kashif Zeeshan

On Thu, Jul 18, 2024 at 2:38 PM [email protected] <
[email protected]> wrote:

> Hello,
> PG V11
>
> Select count(*) from table1
> Returns 10456432
>
> Select field1, field2 from table1 where field3> '2024-07-18 12:00:00'
> Times out
>
> The above query was working fine for the past 2 years.
>
> Backup was taken a day back.  Need to recover complete data as far as
> possible.
>
> Any possible way(s) to do this?
>
> BKR Sivaprakash
>
>
> Yahoo Mail: Search, organise, conquer
> <https://mail.onelink.me/107872968?pid=NativePlacement&c=Global_Acquisition_YMktg_315_EmailSignat...;
>


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

* Re: Re. Select with where condition times out
  2024-07-18 09:38 Re.  Select with where condition times out [email protected] <[email protected]>
@ 2024-07-18 11:53 ` Francisco Olarte <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Francisco Olarte @ 2024-07-18 11:53 UTC (permalink / raw)
  To: [email protected] <[email protected]>; +Cc: Postgresql General Group <[email protected]>

On Thu, 18 Jul 2024 at 11:38, [email protected]
<[email protected]> wrote:
> Hello,
> PG V11
>
> Select count(*) from table1
> Returns 10456432
>
> Select field1, field2 from table1 where field3> '2024-07-18 12:00:00'
> Times out

How do you send the query / how does it time out? Is that the real
query? Is table a table or a view? What does explain say?

> Any possible way(s) to do this?

If your client is timing out, increase timeout, if imposible you can
try fetching in batches, but more detail would be needed.

Suggestions to improve total time had already being given, try to
decrease bloat if you have it, but AFAIK timeouts are configurable, so
it may just be you have a too low timeout.

If it had been working, is field3 indexed? How is the table modified?

Because with a configured timeout, whit an unindexed table ( forcing a
table scan ) the query may be working for years before you hit the bad
spot. Also, the query includes todays date, so I doubt it has been
used for years, probably "a similar one has been used for years", and
probably that is not your real table ( or you have a naming problem ).
Without giving real info, people cannot give you real solutions.

Francisco Olarte.






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


end of thread, other threads:[~2024-07-18 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18 09:38 Re.  Select with where condition times out [email protected] <[email protected]>
2024-07-18 09:42 ` Re: Re. Select with where condition times out Kashif Zeeshan <[email protected]>
2024-07-18 11:53 ` Re: Re. Select with where condition times out Francisco Olarte <[email protected]>

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