|
Nanda_MR wrote: I am using Oracle
That would have been useful info, also what is a lak , presumably lots.
So you know how to get the paged set, you real question is how to optimise the query (using rownum) or if there is a better method to use in orable.
And I'm afraid there I cannot help you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: what is a lak, presumably lots
Indians have a different style of counting big numbers. A lak is one hundred thousand (Indian style: 1,00,000), a crore is ten million (Indian style: 1,00,00,000).
But that's still easy. Stay a few days in India to get confused with more puzzling Indian style information....
|
|
|
|
|
Hi RAH,
I am trying execute my query but it is taking much time(4 to 10 min) to avoid that problem and searching efficient query or solution.
The your last post provide some ideas. it reduce execution time.
Regards,
Nanda
|
|
|
|
|
Mycroft Holmes wrote: also what is a lak
Google would happily have told you ...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I naturally did the google thing, the response was nowhere as succinct as the answer I got here
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Unfortunately conciseness isn't Google's primary strength.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Try...
select * from (
select top 10000 *, row_number() over (order by rownum) as rn
from productlist
) t
where rn between 9990 and 10000
modified on Monday, February 21, 2011 1:26 AM
|
|
|
|
|
Hi
Thanks for Query. It is reduce execution time. but when I try to access above 500000 (Top 500000) records then its taking 2 to 3 min exeuting any other solution.
For if 900000 it is taking 4 to 5 min.
Regards,
Nanda
|
|
|
|
|
SELECT *
FROM (
SELECT *
FROM Productlist pl
ORDER BY somefield
)
WHERE ROWNUM BETWEEN 9991 AND 10000 Note that you can never trust the DB to give you the records in the same order every time, so you need the order by clause.
The field you're ordering by should be indexed if you want to get any speed to your query
|
|
|
|
|
Thanks.
Problem is the table is too big it contains 10 lak to 90 lak data. while access perticular data (ex: 1500000 to 1501000) then it is taking so much time.
The Inner Query execute all records (90 lak) and the outer query filter 9991 to 10000. This is my problem.
Regards,
Nanda
|
|
|
|
|
That's why you need a index on the column you order by, it's already sorted. The optimizer will take care of the inner query.
Do you have an index on the column you're sorting by?
|
|
|
|
|
Hi,
If you do have an ascending surrogate key, one efficient way would be to use that. For example if you have a field called Id and the values are coming from ordered sequence your query could be something like:
select *
from ProductList a,
(select b.Id,
count(*) over (order by b.Id) as runcount
from productlist b
where b.Id > :lastFetchedId) subq
where a.Id = subq.Id
and subq.runcount <= 10
|
|
|
|
|
Hi Mika,
I done similarly in View. Add a new column unique ID and I am adding rownum. In this case I am executing query without any delay.
But one problem is there. In case if order by condition added the output of query is coming wrong(Bug) or a block of rows is order.
Regards,
Nanda
|
|
|
|
|
Hi,
Nanda_MR wrote: I am adding rownum
Just to check: Did you notice that I didn't use rownum at all because it's unreliable in this context (for many different reasons). The example I created shouldn't encounter any of the problems rownum has since the example is based on a running total count on an unique and ascending field.
|
|
|
|
|
Dear All
I have a form "report_test", and a single button "rptstart", when i click that button, i wrote a code, to start a report in printing preview with some viewing some records.
When i click print (printer icon) on the left top corner, the printer prints the form "report_test" with the button but not the actual report am viewing any body can can guide how to avoid this and print the report itself ???
regards,
0 will always beats the 1.
|
|
|
|
|
I am currently trying to code a variable into a SQL string that is used with ADO to create a record within a database. I though am having problems with the proper syntax for a variable. The string works fine with a number but when I try to code a variable I have problems. I need to find out how to code an array as well.
hr = rec2->Open("INSERT INTO mytable(id)VALUES("+ text +")",con2.GetInterfacePtr(), ADODB::adOpenForwardOnly, ADODB::adLockReadOnly, ADODB::adCmdText);
|
|
|
|
|
in SQL string literals need quotes, so I would suggest you try:
...VALUES('"+ text +"')"...
^ ^
Warning: make sure not to insert anything between the single and double quotes there!
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc,
Thank you for your reply.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc,
I am getting the error message: "error C2110: '+' : cannot add two pointers"
|
|
|
|
|
one cannot add pointers together, it doesn't make sense; adding house numbers wouldn't make sense either.
What is your code, and what is the exact line where the error occurs? and what language and IDE are you using?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc,
The error is occuring at VALUES('"+ text + "'). My VS2008 is giving me this error. I am trying to send a record to MS Access.
|
|
|
|
|
You need to enclose your varchar value in single quotes.
hr = rec2->Open("INSERT INTO mytable(id)VALUES('"+ text +"')",con2.GetInterfacePtr(), ADODB::adOpenForwardOnly, ADODB::adLockReadOnly, ADODB::adCmdText);
I find string.Format() to be VERY useful!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Suppose some one purchased a ticket online. [Here the value of a column is pending]
If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours]
So,
How can I do automatic update of a table after 24 hours???
|
|
|
|