Raised This Month: $51 Target: $400
 12% 

Threaded SQL query without making new connections


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sebxx4
Senior Member
Join Date: Feb 2013
Old 10-23-2022 , 02:32   Threaded SQL query without making new connections
Reply With Quote #1

I'm using threaded queries in my plugins bacause it doesn't lags the server. But every query makes a new connection to the database. And my database has limit of 500 connections per hour. Usually it's enought, but sometimes it exceeds this limit and the hosting blocks any new connections for some time.

I tried to ask my hosting if they can increase this limit, but they answeared no. So, is there any way to do threaded queries using single connection to database?

Last edited by sebxx4; 10-23-2022 at 02:34.
sebxx4 is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 10-23-2022 , 12:11   Re: Threaded SQL query without making new connections
Reply With Quote #2

show code
lexzor is offline
sebxx4
Senior Member
Join Date: Feb 2013
Old 10-23-2022 , 15:12   Re: Threaded SQL query without making new connections
Reply With Quote #3

Well, there's nothing to show. Just standard thread query.
sebxx4 is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 10-23-2022 , 18:18   Re: Threaded SQL query without making new connections
Reply With Quote #4

so you want to say you have limited amount for sending queries? or why your plugin make a new connection to the database at every query?
lexzor is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 10-23-2022 , 23:46   Re: Threaded SQL query without making new connections
Reply With Quote #5

do multiple jobs on the same query.
__________________
bigdaddy424 is offline
sebxx4
Senior Member
Join Date: Feb 2013
Old 10-24-2022 , 03:10   Re: Threaded SQL query without making new connections
Reply With Quote #6

Quote:
Originally Posted by lexzor
so you want to say you have limited amount for sending queries?
No, for connections per hour.

Quote:
Originally Posted by lexzor
why your plugin make a new connection to the database at every query?
I donno. Isn't it how the SQL_ThreadQuery works?

Quote:
Originally Posted by bigdaddy424
do multiple jobs on the same query.
How on threaded queries?

Last edited by sebxx4; 10-24-2022 at 03:11.
sebxx4 is offline
sebxx4
Senior Member
Join Date: Feb 2013
Old 10-26-2022 , 01:37   Re: Threaded SQL query without making new connections
Reply With Quote #7

Anybody?
sebxx4 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-26-2022 , 02:17   Re: Threaded SQL query without making new connections
Reply With Quote #8

Doesn't it work, if you connect once in database when plugin load,
store handle of that connection (you have now connection open all the time)
You can do many queries as you like.

When you delete handle, you lose connection.

Of course, don't connect multiple times, if you not delete handle. Or you have multiple connections open.
__________________
Do not Private Message @me
Bacardi is offline
sebxx4
Senior Member
Join Date: Feb 2013
Old 10-26-2022 , 08:32   Re: Threaded SQL query without making new connections
Reply With Quote #9

Yes, I use SQL_MakeDbTuple only once in plugin_init() in all of my plugins. So, SQL_ThreadQuery doesn't make new connection, only the query?
sebxx4 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-26-2022 , 11:07   Re: Threaded SQL query without making new connections
Reply With Quote #10

Maybe you mixing connetions with queries, of that 500 per hour limit.

Tell what host/product you are using which does have that limit ?
__________________
Do not Private Message @me
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode