pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed[Fwd: Optimization in C]
2+ messages / 2 participants
[nested] [flat]
* [Fwd: Optimization in C]
@ 2000-08-18 08:14 Jerome Raupach <jraupach@intelcom.fr>
2000-08-18 13:44 ` Re: [HACKERS] [Fwd: Optimization in C] Thomas Lockhart <lockhart@alumni.caltech.edu>
0 siblings, 1 reply; 2+ messages in thread
From: Jerome Raupach @ 2000-08-18 08:14 UTC (permalink / raw)
To: pgsql-hackers@postgresql.org; pgsql-sql; pgsql-general@postgresql.org
This solution isn't good when there are +10000 tuples in the table, it's
slowly...
anybody can help me ? :
string = "SELECT service, noeud, rubrique FROM table" ;
res = PQexec( conn, string.data() ) ;
if ( (! res) || (status = PQresultStatus( res ) !=
PGRES_TUPLES_OK) )
{
cerr << _ERROR << "Problem SELECT ! " << endl ;
cerr << _ERROR << "Error : " << PQresStatus( status ) <<
endl ;
cerr << _ERROR << "Error : " << PQresultErrorMessage(
res ) << endl ;
PQclear( res ) ;
}
else
{
for (int m=0; m < PQntuples( res ); m++)
{
service = PQgetvalue( resultat1, m, 0 ) ;
noeud = PQgetvalue( resultat1, m, 1 ) ;
rubrique = PQgetvalue( resultat1, m, 2 ) ;
commande = "SELECT SUM(date) FROM table WHERE
service='" + service +
"' AND noeud='" + noeud + "' AND rubrique='"+ rubrique + "'" ;
res1 = PQexec( conn, string.data() ) ;
if ( (! res1) || (status = PQresultStatus( res1
) != PGRES_TUPLES_OK)
)
{
cerr << _ERROR << "Problem SUM ! " <<
endl ;
cerr << _ERROR << "Error : " <<
PQresStatus( status ) << endl ;
cerr << _ERROR << "Error : " <<
PQresultErrorMessage( res1 ) << endl
;
PQclear( res1 ) ;
}
else
{
cout << _TRACE << "SUM ok." << endl ;
PQclear( res1 ) ;
}
}
PQclear( res ) ;
}
Thanks. jerome.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [HACKERS] [Fwd: Optimization in C]
2000-08-18 08:14 [Fwd: Optimization in C] Jerome Raupach <jraupach@intelcom.fr>
@ 2000-08-18 13:44 ` Thomas Lockhart <lockhart@alumni.caltech.edu>
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lockhart @ 2000-08-18 13:44 UTC (permalink / raw)
To: Jerome Raupach <jraupach@intelcom.fr>; +Cc: pgsql-hackers@postgresql.org; pgsql-sql; pgsql-general@postgresql.org
> This solution isn't good when there are +10000 tuples in the table, it's
> slowly... anybody can help me ? :
Someone already responded, and asked some questions about what you are
really trying to do. If you didn't get the message, let us know or check
the mail archives.
Regards.
- Thomas
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-08-18 13:44 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-18 08:14 [Fwd: Optimization in C] Jerome Raupach <jraupach@intelcom.fr>
2000-08-18 13:44 ` Thomas Lockhart <lockhart@alumni.caltech.edu>
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